How do you smoothly transition or lerp a rotation of an object to a new rotation?
My direction changes every time the player presses a button. But when it does, the rotation gets changed immediately, with no transition whatsoever.
Is there a way I can do this?
Here’s the script I’m using, it’s pretty straight forward and simple:
GameObject.FindWithTag("Player").transform.eulerAngles = rot;
rot = new Vector3 (direction.y * 100, 0, direction.z * 100);
I just couldn’t find a way to smoothly transition Player’s eulerAngles to rot since I’m pretty new to Unity and C# itself.
Vector3.Lerp doesn’t seem to work as well with it. It flips out and have no idea why.
Here’s the script I made for it:
GameObject.FindWithTag("Player").transform.eulerAngles = Vector3.Lerp(Vector3.zero, rot, Time.deltaTime * 5);
With this one, for some reason, the rotation just keeps going back and forth.
For example, when I’m pressing the right button, it rotates to right, goes back to Zero, then rotates back to right again, then rotates back to Zero, then rotates back to the right again… at a somewhat fast rate until I let go of the right button.
Maybe I did something wrong with it.
Thanks to anyone who can help ![]()

Try this: GameObject.FindWithTag("Player").transform.eulerAngles = Vector3.Lerp(GameObject.FindWithTag("Player").transform.eulerAngles, rot, Time.deltaTime * 5);
– Slvr99Every time you lerp with Euler angles, a fairy experiences [Gimbal Lock][1]. [1]: http://en.wikipedia.org/wiki/Gimbal_lock
– DMGregory