A* Pathfinding Project

Upon reaching the destination, continuous paths seem to be called to the same spot. Is this normal?


#1

I am using the AIPath/Seeker + a Grid. I am moving my object by setting AIPath.destination to my desired location. This works no problem, but when my object gets to the end of the path it continues to fire off a bunch of pathfinding requests (or so it seems). Please see this screen shot:

PathCOmplete

These messages continue forever without me setting another destination (as in my character is just standing still).

Is this normal? In my main scene I am at some point reaching the destination because AIPath.reachedDestination does equal true (which cancels my walking animation).

To be sure, I created a new scene with none of my own scripts involved and am still getting the same thing, but in this case AIPath.reachedDestination is never true… (although AIPath.reachedEndOfPath will return true.)

this is a 3D game, the Y values of the moving objects and the destinations are the same.

Are those debug messages normal even when not pathfinding?

Thanks


#2

Hi

Yes, this is normal. The agent will repeatedly try to recalculate the path to its destination. Why does it do this even when it has reached the destination? Because the graph might change at any time to perhaps introduce an obstacle right where the destination was, or perhaps a door was opened so that it can now get even closer to the destination, or another agent pushed it away from the destination and it needs to find its way back but it cannot just re-use the old path.

Typically this is not a big performance hit because path requests from one node to the same node are extremely quick (as you can see the computation time for all those paths are less than 0.01 ms).

You might get annoyed by the debug messages though, so you can disable them in A* Inspector -> Settings -> Path Logging.

See https://arongranberg.com/astar/docs/astarpath.html#logPathResults


#3

Awesome! Very much appreciated