- Home /
y and z rotation axis doing the same thing when x is 270 degrees
this has got to be the most annoying thing ever.... when the x axis rotates towards perpendicular with 0 degrees, the y and z axis become more and more similar until they do the same exact rotation when x is 90/270.
Is there any way to fix this besides making it a child of another object and separating the y and z axis between them to achieve the desired rotation. i could do that but it seems like a crap fix for something i should know how to do normally.
Welcome to the joys of gimbal lock. This happens somewhere with any system using Euler angles, which is why internally Unity uses quaternions (which don't suffer from it) - the Euler angles are just for convenience of data entry.
If you're modifying the rotation of an object through code, try using quaternions ins$$anonymous$$d. Quaternion.Lerp, AngleAxis, FromToRotation, and LookRotation make it pretty convenient. You can compose two rotations just by multiplying their quaternions.
We'll have to see more about what you're trying to accomplish to give more specific advice for how to deal with it (something that would qualify as an answer, rather than general advice).
i suppose i did just need some general advice. i have no specific code issues. thank you for the help :)
was able to get what i needed from using quaternions, thx for the knowledge!