Quaternions to EulerAngles weird x-axis interaction
I have an object that the player can rotate in all 3 axes. I have a quaternion tracing the rotation of the object and 3 floats converting that rotation into eulerangles .
Void Update () { urk = transform.rotation; anglex = urk.eulerAngles.x; anglez = urk.eulerAngles.z; angley = urk.eulerAngles.y; }
When i track the angles using Debug.Log, the y and z axes act as expected, going from 0-360. The x on the other hand acts like this: 0-90-0-360-270-360. Rotating on the x axis completely neglects numbers 90-270 and this weird sine like interaction makes it impossible to use the angles for a Boolean statement, which is what i need them for.
Answer by olegkuv · Feb 12, 2017 at 03:41 PM
Another thing that i just noticed, when i rotate the x-axis to 90 degrees anglez is set to 180, and then when x reaches 270, it is set back to 0.
Your answer
Follow this Question
Related Questions
Quaternion.Angle() unexpected output. Compare to Vector3.Angle() which produces correct values. 0 Answers
How to add to a rotation angle? 0 Answers
Avoiding Gimbal Lock with Vector3 EulerAngles and Applying Torque 0 Answers
I can get Quaternion data(x,y,z,w) from simulation program. But, how to assign it in rotation? 1 Answer
Draw a ray from a gamobject and keep direction of the ray relative to the gameobjects rotation. 1 Answer