Stop AIPath agent slowly

Hi there,

I’m wondering if there is a correct way to slow an AIPath agent to a stop? Currently I am removing the path and setting hasPath to false. However I wonder if there is a way to have them resume their path for a few more ‘steps’ to slow down to a stop?

I have tried modifying a few parts of the script, but the result is either unpredictable or doesn’t work at all, as I’m a bit unsure of what all of the plane behaviour is doing.

Has anyone implemented something like this?

Thanks!

Hi

Yes, you can set the isStopped property to true.

ai.isStopped = true;

See https://arongranberg.com/astar/docs/iastarai.html#isStopped

Ah, this is a newer feature? I’ve actually built my own version from the AIPath, and in my project AIPath nor AIBase have the isStopped property.

This feature was introduced in 4.1.something, so it is relatively new.

As a workaround you could probably reduce the max speed of the agent to zero over a short period of time. This will not get you exactly the same behavior, but it may be good enough for your game.