Compare Quaternion to axis
I have the orientation of an object stored as a unit quaternion, and I want to see what angle the object's local x axis makes with the global y axis. What's the easiest way t开发者_开发技巧o do that?
Thanks!
I was overthinking it... rotate the vector (1, 0, 0), the local x axis into the global frame. Dot it with the global y vector, and take the arcCos of it. Since I didn't care about the object being upside down, I took
acos(abs(rotateVector(myQuat, vector(1, 0, 0)), upVector))
精彩评论