NPC Twitching during Translation

It seems like when an npc is translating at a fast rate on the A* line, they rotate back to the destination point, causing twitching.

We are not using Character Controller due to technical reasons.

Is there a solution that doesn’t require shrinking the object or lowering translation speed?

  • We are using A* Pro, if it matters.

Hi

Are you using an included movement script or one you have written yourself?

The movement script we’re using is one we have written, as our movement script is in a custom class we created. but we used your same exact code.
The problem persists even in a new scene. The faster the translation speed and the more checkpoints in a curve the more likely the glitch occurs.

Thanks for the help.

I guess (really just a guess) it’s because the character is moving via velocity and overshoots the target. if so you could try clamping the velocity according to the distance to the targetpoint if it is close, so it lands directly on it.

Hi

This might be what is happening. If your movement script requests a path at some time, it will take some time for the path to be calculated (usually one or two frames), so the character will have moved some distance during that time. When your movement script gets the path back, it will think it needs to turn back to get to the start point of the path. The AIPath movement script solves this (in most cases) by sort of simulating movement from the point where the path was requested to where it is now and checks if that would have made it reach some waypoints at the start of the path.

We had figured out why the rotation was occurring.
The clamping method is causing a vibration when the npc overshoots the intended destination (due to a combination of the translation amount and frame speed) and then teleports to their destination.
Unfortunately, we found the possible solution of lowering the translation speed highly impractical.
Thus, we need some sort of alternate solution, if there is one.

The game we’re working on features a decent (about 200 or so) npcs each with custom, independent ai, so anything that can work but also reduce the tax on the fps is important (hence getting rid of Character Controller).

Thanks for the assistance.

Hi

Do you think you could share a video of this happening? That would help a lot.