Hello everyone! First time here. Anyways, i am making a rocket game where the rocket turns a bit with the arrow keys and returns to starting rotation if otherwise. So i managed to get that happen smoothly in the up and right keys but when i press the negative axis of them (down and left), it just spins like a top and starts to spin like crazzy! i dont know what is happening as the positive side seems to work nicely. The rocket is a rigidbody but that does not seem to have an effect on Lerp or eulerAngles. So is there something about Lerp or wrong with my script?

Thank you for your time and coorperation.

public float turnPower;

void Update ()
{

Vector3 r = transform.eulerAngles;
float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical");
Vector3 m = new Vector3 (v * turnPower, 0, h * turnPower);
transform.eulerAngles = Vector3.Lerp (r, m, Time.deltaTime);
}

Getting value form transform.eulerAngles isn’t safe because the rotation can suffer from Gimbal lock.

the best way you can do is store your rotation to another variable, or use Transform.Rotate

float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical");
Vector3 m = new Vector3 (v * turnPower, 0, h * turnPower);
transform.Rotate(Quaternion.Euler(m * Time.deltaTime));

this code is untested, but if didn’t work, try make another variable and get rotation data from there instead of transform.eulerAngles

For my case, I maintain the following set of variables

Bone

Initial euler angles

Target euler angles to transform to

Current euler angles

Initial euler angles is for reference, or whenever we want to reset the rotation of bones for the mesh.

In input update loop (Update()), update 3 (target euler angles) only.
In LateUpdate(), use Mathf.LerpAngle() to lerp angle values from current angles to target angles using similar to the following code.