Support Forum

richAI.destination and seeker.StartPath()


is it ill-advised to use both seeker.StartPath(path) and richAI.destination for the same agent? I mostly use .destination, but sometimes - for example for constructing a flee path - I have to use .StartPath(path), and it doesn’t work correctly because before that I had to set .destination = new Vector3(float.PositiveInfinity, ...) to let the agent stop. While I already feel that setting the destination to PositiveInfinity is a bit ‘unclean’, now I also have to set the destination to the last point of the path in the callback of .StartPath(), which feels even more like a hack.

Is there a better way? Or is it just a bug that the agent doesn’t start the path via .StartPath() in this case?


If you want to use custom paths with the RichAI movement script (or any built-in movement script really) then the recommended way is to:

// Disable the built-in path recalculation
ai.canSearch = false;
// Give the AI a path to calculate

The agent will ignore the destination when this is done. However it also means that properties like reachedDestination will not work. Not all paths have a well defined destination, but if you do know it you can set the destination property to that and things will work as expected.