A* Pathfinding Project

Node connections that shouldn't exist


My grid is generated correctly for the most part, but there’s always some node connections happening through colliders even if I have set Collision Testing, here is an example, and also my A* config is displayed:

As you can see, nodes on both side of the fence are connected, despite the fence having a box collider that should completely block the collision testing. This usually happens here and there in all my maps, forcing me to move around the objects, but I’d like to know if there’s an explanation/solution on why it’s happening.



You have set the collision testing diameter to 0.8, this means it will only be 80% of the width of a node and may therefore miss some obstacles. If you increase it to 1.0 it should work better.



I thought setting it to 0.8 would be the same as using a capsule collider with 0.8*node size diameter and trying to walk from one node to the next, but that would always be stopped by a wall box collider which isn’t the case. What does exactly mean that collision testing diameter?

If I increase it to 1, the collider is unable to go through most normal-sized door models out there…



It is not the same as that. Doing that would make the grid graph very slow to scan. What it does is to check if the node should be walkable by checking if there are any colliders within a capsule centered at the node with a diameter of ‘collision testing diameter * node size’.

Here are the docs for it https://arongranberg.com/astar/docs/graphcollision.html#diameter