A* Pathfinding Project

Unexpected jumps/snapping between overlapping point graphs


Hi! I’m having a problem with using several point graphs to define the path in a simple 2D game. I’ve defined a different point graph for every floor in the game (sometimes they overlap, like the red and green graphs here) and connected them via the yellow nodes (using NodeLink):

When the player walks on those, the character’s sorting order is set to the destination node’s sorting order, in order for the player to appear behind the stairs. The problem is, sometimes there are some strange jumps and the player doesn’t pass through the connector node (even though no connections between those two graphs exist except the yellow connector node) so they end up in front of the stairs. The Seeker is currently set to Node Center (Snap to Node) on the start and end node.

I’d appreciate your help!



Sorry for the late answer.
I think what is happening in these cases is that the player did a path recalculation. When a path recalculation is done it will find the closest node as the starting point. If another node (possibly on another graph) was closer then, it will move to that node.

I’m not quite sure how your game works, but you might want to restrict your agents to only use a particular graph by changing the graph mask on the Seeker component.