Character does not rotate when selecting grid behind Unit

On the Input Refactoring Video - If you watch at second 26 to 28. The Unit does not rotate to go to the direction, it walks backwards.

Can you explain why this happens?

Thank you for this course!

That’s the negative side effect of using Lerp for rotation. Lerp takes in a Vector as input so when doing a 180º turn it causes that vector to smoothly interpolate to 0,0 before suddenly flipping to the other side.
If you want to fix that side effect you can instead use Slerp, everything will work the same and it won’t have that issue since Slerp works with a Direction instead of just a Vector which will cause it to smoothly rotate even on 180º

3 Likes

Thank you for the explanation, and thank you again for this wonderful course!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms