- Home /
Question by
awesomeface · Dec 15, 2013 at 04:49 AM ·
rotationquaternioneuleranglesgimbal-lock
unwanted rotation on the y and z axes
in unity, if I have it in play mode and I change the rotation of the x axis to 180 degrees, for some unknown reason, the y and z axes rotation become 180 also
Comment
Answer by Kiloblargh · Dec 15, 2013 at 05:09 AM
EulerAngles should be set all at once, not individually. Like this:
var oldRotation : Vector3;
oldRotation = transform.eulerAngles;
transform.eulerAngles = Vector3 (180, oldRotation.y, oldRotation.z);
Also, you know you can't just set rotation.x, right?
you misunderstand, I meant when I change the x axis rotation directly through the inspector view