A* Pathfinding Project

StartMultiTargetPath returns path with different end point



My Graph is Layered Grid and my game is voxel based. When I call StartMultiTargetPath and pass x number of end points, sometimes I get as a result a path with end point that is not passed but close to that passed point.
e.g. Lets say i want to find path to position (20,5,15) and my agent is on (10,4,5), StartMultiTargetPath will return path (20,4,15), a layer below if that position is free.
What would I like for result is paths with exact same end points as i passed to method. How can I do that, have I missed something in settings?


Help please, I really need this.



Sorry for the late answer.
Is there a node at (20,5,15) that it can actually reach?

Do you think you could send a screenshot of this?


I thought it was occurring in both cases when path can or can not be reached, but while doing some debugging I realised it only happens for paths that can’t be reached.
I don’t have actual screenshot of that happening since I made a workaround for that problem some time ago, but here are some drawings.
So basically I would pass blue points to StartMultiTargetPath and as a result I would get red point as closest path event tho I haven’t passed that point to a method. That said i’m forced to use StartMultiTargetPath to calculate all paths not only closest, then check if end points of those paths match with points I passed to a method earlier and get closest.

So once again lets get through some example.
I want to find closest path from position {20,5,15(can be reached) ;21,5,15(can’t be reached)} and my agent is on {10,4,5}.
StartMultiTargetPath in this case will return two paths with end points {20,5,15 ;21,4,15}.
{21,4,15} was not passed to a method but I got it as a result for closest path to point {21,5,15} that can not be reached.
What I would like for a result is only closest path with end point that I passed to a method.



Ah, I see.
Normally the system will try to find the path to the closest point that can be reached. You can set the upper limit for how far away it will look for those points in the inspector. Reduce A* Inspector -> Settings -> Max Nearest Node Limit to something appropriate (e.g. 1 node width).


Thank you, for now it seems it is working properly, I will get rid of my workaround and let you know if I get into some problem caused by some side effect if any.