Support Forum

Path failing when using multiple grid graphs

In my project i will have agents with multiple sizes.
I currently only have one agent type, using the AIPath (radius 0.5) and seeker component (with Max Nearest Node Distance set to 4).
But to handle having various agent sizes, I will need multiple graphs, so I wanted to test it out.
I also have an RVO simulator in my scene and RVO controller on my agents.

When using a single grid graph, everything works fine, as soon as I add a second one AND make its node size bigger than the first (the first is 0.5, the second is 1), I start getting the following error for some paths.

Path Failed : Computation Time 0.00 ms Searched Nodes 0
Error: Couldn’t find close nodes to the start point or the end point
Path Number 3 (unique id)

I am telling my agent’s seeker component to use the proper graph for its size (the second one with the node size of 1).
I placed a breakpoint on that error message, and examined the path in the editor with gizmos enabled, there’s clearly many walkable paths, I see plenty of green nodes between the start and end location.

What’s weird is this doesn’t happen all the time, some paths work fine, others give that error.
If I make both graphs have the same node size, then everything works.
I tried increasing the Max Nearest Node Distance from 4 to 10, that didn’t help.

Am I misusing this feature, or did i set it up wrong?

I’m on Unity 2022.1.20f1 and A* pro v4.3.60

Hi

Do you have ‘prioritize graphs’ enabled in your A* Inspector → Settings tab?

Not sure why this would happen, really…

No I don’t, I will try to investigate this further, do you have any tips or suggestions for where to look or what to try?

I have slopes in my terrain, could the terrain height (and height of agents on slopes) be playing a role here as well? Both my grids have the exact same properties, except for node size (one is 0.5 and the other is 1), and their resolution or size X by YorZ (because the one with node size of 0.5 needs to be bigger to cover the same area as the one with node size of 1)

Try to call

var nn = NNConstraint.Default;
nn.graphMask = seeker.graphMask;
var closestNode = AstarPath.active.GetNearest(somePoint, nn).node;

And check if the closest node is the one you expect.

Could you send me a screenshot of your seeker settings?

Seeker, AIPath and RVOController on the agents

PathFinding settings

Here’s a debug view of the situation (only the 2nd graph, the one with node size of 1, is shown, that’s the one used by the agent’s seeker):

Here the selected agent (left side) was told to move to its target ( right side, agent with green square above its head)
Google Photos

Same agent from a different view
Google Photos

Here we selected the target agent (green square above it), that the first agent was told to move to (I hid the models here to make it more clear.)
Google Photos

This is the debug of the path, the originalStartPoint and originalEndPoint corollate with the positions of the agents shown above. If we look at the transform of the agents, they match the start/end point of the path.
Google Photos

We can clearly see that there is a valid path, the surface is all green.

do you still think I should still try this, or is it clear from the screenshots?

By the way I notice something odd, if I tell the seeker to use all graphs (and I only have the two), I get the pathing error all the time, my agents can’t move at all.
But if I tell the seeker to only use 1 of the graphs, then I don’t get the error all the time, only sometimes, and it seems to happen when a slope is involved.

that pathing error seems to go away if I enable Prioritize Graphs in the Pathfinder component.
I even added an extra third graph with a bigger node size (1.5).
As soon as I disabled Prioritize Graphs, the error comes back, not sure why since the seekers are told to use a single graph anyway… something is not right.

Hmm. This is strange. Prioritize graphs shouldn’t be required.

Are you calculating paths manually in any way? Or do you just assign ai.destination?

The agents assign ai.destination, I do not do any manual path calculations.
I use PathUtilities.IsPathPossible() to see if a path is possible for some logic in my game.

Hmm…
Do you think you could try using the beta version? I cannot see why this should be failing for you, but it’s possible it’s caused by some bug which has already been fixed in the beta.

https://www.arongranberg.com/astar/download

I’m on the latest version of the beta, v4.3.61