0
\$\begingroup\$

I have a quaternion Q1:
X: -0.023995593190193176 Y: -0.4076451063156128 Z: 0.04357096180319786 W: 0.9117847681045532

and I have a keyframe value Q2 which is based on Q1: X: 0.176469 Y: -0.368251 Z: 0.479782 W: 0.776569

Now my question is how can I get the correct keyframe values if there would be no extra start values ? I mean if Q1 is 1,0,0,0 (w,x,y,z). (no extra start values) So basically I need to rotate my object to the same pose but from the default values (1,0,0,0) start not from Q1.

\$\endgroup\$
  • \$\begingroup\$ So the rotation for the keyframe is Q1*Q2? \$\endgroup\$ – ratchet freak Jun 18 '18 at 16:11
0
\$\begingroup\$

Let's see if I understand correctly...

  • Q1 is our absolute starting rotation

  • Q2 is our absolute ending rotation - ie. it includes both Q1 and some additional rotation

...and you want to get let's call it Q_delta, the change in rotation from Q1 to Q2? (Or, equivalently, the corresponding Q2 if Q1 were the identity quaternion (w=1, xyz = 0)), is that right?

If so, it's fairly straightforward:

Q_delta = Q2 * Inverse*(Q1)

To see why, we can derive it from the fact that Q2 is Q1 with an extra rotation of Q_delta applied on top (here using the convention that rotations stack from right to left):

$$\begin{align} Q_\Delta \cdot Q_1 &= Q_2\\ (Q_\Delta \cdot Q_1) \cdot Q_1^{-1} &= (Q_2) \cdot Q_1^{-1}\\ Q_\Delta &= Q_2 \cdot Q_1^{-1}\ \end{align}$$

\$\endgroup\$
  • \$\begingroup\$ Thank you so much :D Finally someone who understood the problem. \$\endgroup\$ – Vettel.Sebastian Jun 18 '18 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.