AI Path Movement without Rotation

Hello,

first thank you very much for the great Asset!

I want to use for an TopDown 2D Game the “Ai Path” Script but without to rotate the character.
How can this be achieved ?

Greets
Holger

Hi

The AIPath script uses some logic to slow down when it does not face the correct direction. If this should be enabled or not is currently not exposed in the inspector, but fortunately it is easy to change.

// Find this line
velocity2D = MovementUtilities.ClampVelocity(velocity2D, speed, slowdown, true, movementPlane.ToPlane(tr.forward));
// and change the 'true' parameter to 'false'

Then it should work if you just make sure to set the rotation speed to zero.

For more information about pathfinding in 2D. Take a look at this page: https://arongranberg.com/astar/docs/pathfinding-2d.php

2 Likes

Yes, this works great!
Thank you very much for your ultra-fast response!

1 Like

Genius. Spent ages fluffing around trying to figure that out.