I have a spaceship with a Rigidbody which can be controlled by the user. Inside FixedUpdate I modify x and z rotation to turn it upright while the user still controls the spaceship. It's a kind of an autopilot for getting it back to horizontal alignment.
transform.rotation = Quaternion.Slerp( transform.rotation, Quaternion.Euler(0.0f,transform.rotation.eulerAngles.y,0.0f), Time.deltaTime*3.0f );
A rotation around the x axis is corrected by the autopilot (Slerp) very well. A rotation around the z axis will be corrected also, but the spaceship gets always a slight rotation around the y axis (counter clockwise).
I'm wondered because I think normally the line above shouldn't modify the y axis.
What's my fault here?
↧