When I have two orientation quaternions, how do I find the rotation quaternion needed to go from one to the other?

后端 未结 2 2076
心在旅途
心在旅途 2021-02-09 01:49

I\'m using quaternions in my game, and I\'m wondering how, when I have two orientation quaternions, I can get the rotation quaternion needed to go from the first one, q1, to the

2条回答
  •  逝去的感伤
    2021-02-09 02:16

    In order to "divide" with a quaternion, you invert it so that it's the opposite rotation. In order to invert a quaternion, you negate either the w component or the (x, y, z) components, but not both since that would leave you with the same quaternion you started with (a fully negated quaternion represents the same rotation).

    Then, remember that quaternions aren't commutative. So:

    q2 = r*q1
    q2*q1' = r
    

    Where q1' is the inverted quaternion and it must be multiplied on the right side of q2 to get the right result.

提交回复
热议问题