Agent acceleration and rotation speed is inconsistent

Hey there,

I’m working on a top-down/isometric game. I discovered this issue when I reworked my animation controller to use more/richer animations, like runStart/runStop animations. It’s all working fine with AIPath agent.

Although sometimes, like 1 in 10 cases, when agents starts its movement, the acceleration and/or rotation speed is much different, slower then in other cases. The problem is, there is no pattern, it happens randomly. For instance - when I set a target to be at 90 degrees from the player forward axis (side node - player and target positions are always snapped to their respective node positions), 1 in 10 times, it rotates and accelerates much slower then in other cases. It happens in all possible ways of movement, moving towards target at 180 degree, 90 degree, anything in between, even when moving straightly forward.

Demonstration video:
“Bad” behavior occures at 0:05 and 0:28 mark.

What could be causing this behavior? I don’t use rigididBody, there is no root motion either, so there is nothing that could interfere with AIPath script from the outside.

Thanks in advance


I’m so sorry for not testing properly before posting here. I found a solution while shooting the demostration video posted above.

Turns out this behavior disappears when I set repathRate to 0. I don’t use any dynamic objects that could interfere with path at runtime, so I think it’s going to work for me. Hope this helps someone in a future.


I couldn’t really see the issue in the video, but based on your later post it sounds like the issue is that the agent is not recalculating its path often enough.

You can call ai.SearchPath right when you change the destination to force it to immediately recalculate its path. Having a repath rate of 0 is usually not the best idea since it uses up a lot of CPU power to calculate the path every frame. Though if you only have one or a few characters this shouldn’t matter much.

Well I may be a sick purist, but I think it’s clearly visible in the video, especially on the marks I’ve pointed, that some rotations take much more time than others.

Ah so setting the repathRate to zero doesn’t turn it off entirely, it runs every frame? That’s good to know, I’ll figure another way then. I’ll try to calculate the path on destination change, that seems like a reasonable way of approaching it.

Thank you