A* Pathfinding Project

Should I be using AIPath or Seeker?


#1

I am currently working on a project that involves click to move (ARPG style). My partner and I are trying to figure out whether we should be using ai.destination and ai.SearchPath or if we should be using Seeker.Startpath.

Which method do you suggest we use? And what are the benefits and negatives between using AIPath vs. using Seeker directly?

I realize I’m not the only one who has asked this and I’ve read through all of the different posts but I still can’t seem to wrap my head around when I should be using seeker vs. when I should be using AIPath.destination.

Thank you!


#2

Hi

Generally you should use the AIPath methods and properties directly.

If you just want the agent to move to a point, use ai.destination.

In some cases you may want to have complete control over the path requests. In earlier versions the only way you could do this was to call seeker.StartPath yourself. In newer versions you can set use ai.SearchPath to control the rate of path requests or ai.SetPath if you want to use custom path types as well. This has the advantage of keeping the internal state of the AIPath script consistent, so things like ai.pathPending will work as expected.

Note also that you should set ai.canSearch = false if you want to prevent the agent from recalculating its path automatically at regular intervals. This is primarily important if you are going to use the ai.SetPath method.


#3

Thank you Aron! This is exactly what I was looking for.