Help with Slerp not working as expected


I am trying to rotate a Game Object 90 degrees using Slerp. I have used Slerp before when rotating my character to some success, but for some reason, this particular case won’t work, and I suspect it has to do with the Input System.

When I use this code, the button press rotates the object a small fraction of the amount it is supposed to, and it rotates it instantly without any “slerping.”

    public void RotateSelectedObject(InputAction.CallbackContext context)
        Vector3 newRotationVector =;
        Vector3 oldRotationVector =;
        bool rotated = false;

        if (context.performed && currentLookingAt != null)
            oldRotationVector = currentLookingAt.transform.eulerAngles;
            float newYRotation = oldRotationVector.y + 90f;

            newRotationVector = new Vector3(0f, newYRotation, 0f);
            rotated = true;    
            //currentLookingAt.transform.eulerAngles = newRotationVector;  

        if (rotated == true)
            currentLookingAt.transform.eulerAngles = Vector3.Slerp(oldRotationVector, newRotationVector, Time.deltaTime * 10f);
        rotated = false;

currentLookingAt is a gameobject in the class. I added the bool and moved the slerp outside of the first if statement because I assumed the problem had to do with the Input System state, but I could be wrong. If I comment out the slerp stuff and just use the commeted line “currentLookingAt.transform.eulerAngles = newRotationVector;” it works fine, but obviously without slerping.

Could someone explain what I’m doing wrong?


Slerp is best used for curved motion from one point to another. If you are looking to rotate an object slowly then you should use Quaternion.Lerp.