- Home /
Why assigned Quaternion is creating wrong values in its Transform component
I have a quaternion that I'm assigning to a transform.
When I log the quaternion's euler angles, I get the expected angles of (347, 357, 0), which represent a slight upwards orientation in the x-axis, with the y-axis rotation being negligible.
However, when I assign the quaternion to the transform, the transform component in the editor reports a completely different rotation of (177, 85, 6.6).
Furthermore, the quaternion variable is actually generated and assigned every update cycle. For debugging, I'm manipulating the generation to create rotations that should be roughly in the (350,0,0) range. The logged values from update cycle to cycle prove this and remain steady in the (350,0,0) range. However, the rotation in the transform component shows either constant increase or decrease to all 3 rotation axis from update cycle to cycle. The above example I gave was actually the result of the last update cycle before I stopped the program.
I cannot understand the massive discrepancy. It's the exact same quaternion variable that I'm assigning to the transform and printing out the log values. Even more mysterious is why all 3 axis values show a constant increase/decrease to their values whilst the logged values remain relatively constant from cycle to cycle. Anyone have any idea? Thanks!
You should specify in code what you're doing exactly. Also I assume there are no physics on the object? And object is not parented by another gameobject? (if so, try printing localEulerAngles instead).
Your answer
![](https://koobas.hobune.stream/wayback/20220613053140im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotate children (Cards) on a panel (maybe using lerp, or another method?) 1 Answer
Follow rotation on Y axis ONLY clockwise/counterclockwise. 1 Answer
How to use a negative value when MathF.Clamping a eulerAngle? 1 Answer
How do I clamp the Z-Axis Rotation for this code? 1 Answer
Rotating a parent object to achieve a specific child rotation. 2 Answers