1
\$\begingroup\$

For a given animation with the set of 3D coordinates of every joint and corresponding global rotations quaternions Q(X, Y, Z, W) in right-hand coordinates (Y-up, X-left, Z-forward) - pic. I want to change axis X to be consistent with Unity (Y-up, X-right, Z-forward).

enter image description here

For coordinates it is obvoius: X' = -X and works as expected.

For rotations in quaternions assign I probed different options from other sources:

  • X, -Y, -Z, W
  • -X, Y, Z, W
  • -X, Y, Z, -W

So, what math behind flipping X axis and how can I achieve this transformation?

\$\endgroup\$
1
  • \$\begingroup\$ There are about 20 questions which are basically the same. I posted a solution i found works for me in this other post: stackoverflow.com/questions/39040325/… I hope that helps others. \$\endgroup\$
    – aheigins
    Nov 22, 2022 at 11:39

1 Answer 1

1
\$\begingroup\$

X, -Y, -Z, W <-- This one is correct.

First you replace the axis you have (X) with the axis you want (-X), giving you:

-X, Y, Z, W

Then, since you've flipped an odd number of axes, you're in a mirror image universe with reversed handedness, so the sign of the angle needs to change too. That means negating X, Y, and Z, giving the final result:

X, -Y, -Z, W

I've shown these steps in a few prior answers, so remember to do a search first to find solutions even faster than writing a post and waiting for a reply.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .