NPC rotating multiple times when changing direction on diagonals (A* Pathfinding Project + FollowerEntity, 2D)

Hi,

I’m using the A* Pathfinding Project with a FollowerEntity (Grid Graph) in a 2D top-down game.
Most of the time the movement works fine, but sometimes when the NPC changes direction — especially when moving diagonally — it starts rotating on itself before continuing.

The strange part is that sometimes it only spins once, but other times it can spin many times in a row (up to 10 full rotations) before resuming its path.
It looks like instead of rotating by the shortest angle to face the target, it sometimes rotates in the opposite (long) direction, causing the spin.

I’m attaching a short video showing the problem.

Has anyone experienced this behavior before?
Any suggestions on how to fix it would be greatly appreciated.

Thanks in advance!

https://www.youtube.com/watch?v=OijWnVY0_ow


Hi

I have a few fixes for this scheduled for the next beta version. Wait for that and then let me know how it went. :slight_smile:

1 Like