views:

22

answers:

1

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 to do that?

Thanks!

+1  A: 

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))
Ben Jones
I think you need `myQuat.ToAxis()` in the code above.
jalexiou