- Home /
Question by
stephenart · Jul 24, 2017 at 03:12 PM ·
c#rotationquaternionrotation axis
Odd rotation on the wrong axis
This is my code being called from the update() function.
void turn()
{
//rotation
yaw = Input.GetAxis("Horizontal") * Time.deltaTime * turnThrust;
pitch = Input.GetAxis("Vertical") * Time.deltaTime * turnThrust;
transform.Rotate(-pitch, yaw, 0);
}
My problem is, this should only turn on two axes, but if I use yaw and pitch at the same time it also barrel rolls on the un-used axis.
I'm using the script on the default cube with the camera parented to it and you can see it tilted on all three axes.
Any help?
capture.png
(171.6 kB)
Comment