How to use FleePath(& other Paths) with AIPath?

I’ve extended AIPath and have been setting it’s Destination, and I pass the intended velocity of AIPath to my animator to handle locomotion/root motion animations.

This all works fine and dandy when setting the Destination directly, but how would I go about passing a Path to AIPath to follow? I’ve tried mixing the solution of moving position-to-position in a calculated path’s VectorPath values, but this throws errors and is inconsistent, likely because I’m setting the Destination to each node until reaching it.

So, is there any way to pass a Path to AIPath to follow?

Hi

Yes, you can use ai.SetPath(myCustomPathType). Just make sure to set ai.canSearch = false before to disable the agent’s own path calculation. Also, make sure you are using the latest version since some fixes related to this went into the latest version.

You can find an example here: Wandering AI Tutorial - A* Pathfinding Project

1 Like