A* Pathfinding Project

The seeker start to move when call StartPath()?


Sorry for stupid noob question.

I expect the function StartPath() is just to find out the available path for seeker.

But when I call startpath(), the seeker object start moving. Shouldn’t it stay at where it is?



The value isStopped is by default false. So aslong as canMove is enabled the agent will move as soon as it’s able to.


StartPath() do not update Astar Path in same frame?

I have set canMove to be false, so StartPath() will reset canMove to true automatically?

My game is turn based chess, I think canMove is much better than isstopped, because I don’t need the path caculation all the time.



Seeker.StartPath() only calculates a path.
The AI will take care of the actual movement.



The AIPath script (and other movement scripts) listen to paths completed on the Seeker and use those results.

If you want to calculate a path completely separately from the seeker you can do this:

var path = ABPath.Construct(startPoint, endPoint, OnPathComplete);

void OnPathComplete(Path path) {
    // Optionally if you want to use the path modifiers attached to the Seeker
    // Do whatever with the path
    // You can for example use ai.SetPath(path) to make a movement script follow it

See https://arongranberg.com/astar/docs/callingpathfinding.html for more info