How to stop The connection between two adjacent grid

image
image

Just like the pictures, i am make a SLG game demo, A player Come up or down the slope(A),but now player can come up from the slope left or right(c/b) ,what i need is from the forward(B); any one have good idel?

c A b (A is slope)
z B z

Hey,

Looks like you’re working with an almost complete grid like structure. So a possible solution here might be setting the connection count to 4 instead of 8 on the grid graph options.

yes i know it, but now the connections is 4 in my project, And the reason for that is because MaxClimb ,you can look pic_2, The walkable was connected,so player can move from d/b to a; I just want to know how to disconnect d and a or b and a; I also can lose decrease the value of MaxClimp,but c and a can`t connected, it means player can not move to a from c. thank you !

You can use the https://arongranberg.com/astar/docs/meshnode.html#RemoveConnection function to remove any other node from the current node.

I’m not aware of a less manual method for this at the moment.

thank you,I will have a try;

Hi

You can try the latest 4.3 beta (version 4.3.3). I have added a feature I had planned to add for a long time to that beta which helps with exactly this situation.

Here is the documentation for the new feature: https://www.arongranberg.com/astar/documentation/dev_4_3_3_4b28c68b/gridgraph.html#maxStepUsesSlope

You can download 4.3.3 here: https://www.arongranberg.com/astar/download

thank you for you help!


I was learning the example( Example14_TurnBased_Hexagon), I want to get all walkable node,when i set movement point, so there are some surprise,that i find when movement point is 5 and 6 we get ConstantPath.allNodes is same, your also can set (10 and 11),(17 and 16) I don`t not it is a bug or what parameters have I not set correctly, but in this scene i just disable the something what you can see from the picture. if you have good idel please tell me.thanks again. [ version 4.2.8]

Hey,

I personally think a new thread for this issue would have been easier to track.

I was able to recreate this in 4.2.8, but not in 4.2.4 so there is definitely a bug going on here.
So it’s def something on the A* side of things.



I creat a new scene to test and find that movementPoint/2 is the max walkablePoints( The maximum points to travel in one direction) [GridGraph: shape= grid, Connections=4], but int the example( Example14_TurnBased_Hexagon) It does`t fits that pattern, I’m a little confused now , Maybe i misunderstand the parameter[movementPoint], I always thought that movementPoints==walkablePoints,
[I was used version4.2.8]

Hi

It looks like there’s a silly bug here.
The connection costs for hexagon graphs are a factor of sqrt(3/2)≈1.22 too large.
The ConstantPath which the turn-based example uses finds all nodes which will take less than a given cost to reach. The turn-based example uses the path with a maximum cost of 1000*movementPoints which is intended to correspond to movementPoint nodes. Since the hexagon diameter in that example is 1.0 the distance between two adjacent hexagons is also 1.0 and thus the connection cost should be 1000 (it is always supposed to be 1000*world distance). However due to this bug the connection costs were 1224 instead which caused this issue.

Note that in your grid graph example the movement points are also proportional to the node size of the grid. So if you have a node size of 0.5 then each node will cost 0.5 movement points to traverse. The grid graph was not affected by this bug.

I have uploaded a fix in version 4.3.4 here: https://www.arongranberg.com/astar/download