Path returns PathCompleteState.Complete instead of PathCompleteState.Partial

I’m using my own “AI” and schedule the agent tasks based on return from path.CompleteState. However, agent path never returns PathCompleteState.Partial, even for paths that are partial (like in included screenshot, target is the green plant thing).

Is it again due to seeker start/end modifier being set to ClosestOnNodeSurface, and therefore technically “successfully completing” the path? If yes, how can i avoid it, can path return PathCompleteState.Partial while end modifier is set on ClosestOnNodeSurface? Can i somehow get path state before the end modifier is applied?

Or is the only way to compare/check distance of OriginalEndPoint and actual path end point on PathCompleteState.Complete?

EDIT: Ah, i see, it’s not implemented yet. How would You check if the path is complete? Does approach below looks reasonable, or would You know a way to do it better?


if(pooledPath.CompleteState == Pathfinding.PathCompleteState.Complete &&
(pooledPath.vectorPath[pooledPath.vectorPath.count - 1] - pooledPath.originalEndPoint).sqrMagnitude > NodeSize * NodeSize)
   return true;  // Path is calculated and complete
else
   return false; // Path is either not calculated or partial

Hi

The partial result is for another experimental feature. It is not enabled by default and doesn’t do what you want anyway.

The reason it doesn’t do this is because it is really hard to define what a partial path is in the general case. What if the destination was 1 meter above the ground, is that a partial path because it didn’t reach it? There are so many special cases and different ways to define things.

Your solution works well for grid graphs. Though it will mark it as partial if the destination was far above the ground because your check also does a Y axis check.

You can also do something like:

bool reached = pooledPath.path[pooledPath.Count-1] == AstarPath.active.GetNearest(pooledPath.originalEndPoint, NNConstraint.None);

Which also works well for grid graphs (it checks if it could reach the closest node (including unwalkable nodes) to that point). For other people reading this thread later, this check will not work for recast/navmesh graphs or point graphs because the unwalkable regions of the world are represented there, not using unwalkable nodes, but instead the absence of nodes.