2
$\begingroup$

I have a rotation quaternion in my 3D model and it uses the right-handed coordinate system. Now I'd like to convert it into a left-handed since my game engine (Unity) uses left-handed.

These are the axis in my 3D model

enter image description here

while these are the axis in my destination engine

enter image description here

I read around that first I need to negate the imaginary part and then apply a $M$ matrix that will convert between right-handed and left-handed. For the case above I tried with

$q_{rh} = q0 + q_1i + q_2j + q_3k$

$M = \begin{bmatrix}-1 & 0 & 0\\0 & 0 & 1\\0 & 1 & 0\end{bmatrix}$

$q_{lh} = q0 + q_1i - q_3j - q_2k$

but the animation I set up didn't work anymore. Am I getting something wrong? To add more context: I imported the model switching the sign of the X axis for all of its vertices.

$\endgroup$
  • 2
    $\begingroup$ If you're negating the imaginary part, you should have $$ q_{\ell h} = q_0 \color{red}- q_1i -q_2j - q_3k $$ $\endgroup$ – Omnomnomnom Feb 8 '17 at 17:04
  • $\begingroup$ @Omnomnomnom how come? I thought I should first get all negatives and then multiply by that matrix (so $q_1$ would become positive again) $\endgroup$ – Dean Feb 8 '17 at 20:04
  • $\begingroup$ Well, you can compare that to the output of multiplying $q_{rh}$ by $M$ $\endgroup$ – Omnomnomnom Feb 8 '17 at 20:08
  • $\begingroup$ @Omnomnomnom That would be the complex conjugate I suppose, but I still don't get it $\endgroup$ – Dean Feb 8 '17 at 20:14
  • $\begingroup$ I think that all the bit you read is saying is that to flip the coordinate system, just take the conjugate of your quaternion before applying the usual computations. $\endgroup$ – Omnomnomnom Feb 8 '17 at 20:18

Your Answer

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

Browse other questions tagged or ask your own question.