开发者

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜