How do I modify a quaternion such that the Euler rotation on one axis is zero?
-
24-10-2019 - |
Question
I've got two nodes, and I know the rotation of only one of them.
I want to apply the rotation of node 1 to node 2, but with one axis zeroed out (in Euler terms).
How?
Solution
Never mind, I figured it out.
e.g. For x axis:
double xRot = -(myQuat.ToEuler().x)
Quat qDiff = Quat(sin(xRot / 2.0), 0, 0, cos(xRot / 2.0)).Normalize()
Quat myQuatZeroX = myQuat * qDiff
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow