4
\$\begingroup\$

I have Euler angles from a right handed system that I am trying to convert to a left handed system. All the information that I have read online says that to convert it simply multiply the axis and the angle in the correct order and it should work. In other words, Z * Y * X. When I do this what I see in Maya, and in engine still do not match up.

This is what I have so far:

static Quaternion ConvertToRightHand(Vector3 Euler)
{
    Quaternion x = Quaternion.AngleAxis(-Euler.x, Vector3.right);
    Quaternion y = Quaternion.AngleAxis(Euler.y, Vector3.up);
    Quaternion z = Quaternion.AngleAxis(Euler.z, Vector3.forward);
    return (z * y * x);
}

Keeping the -Euler.x helps keep the object pointing up correctly, but when I pass ( 0,0,0) to face in the -z, it faces in the +z. Help :/

\$\endgroup\$
2
  • \$\begingroup\$ I don't why, even though it kinda make since, I had to add 180 to the Y axis and flip the Y angle. But it worked. static Quaternion ConvertToRightHand(Vector3 Euler) { Quaternion x = Quaternion.AngleAxis(-Euler.x, Vector3.right); Quaternion y = Quaternion.AngleAxis(-Euler.y + 180, Vector3.up); Quaternion z = Quaternion.AngleAxis(Euler.z, Vector3.forward); return (z * y * x); } \$\endgroup\$ Commented Oct 16, 2012 at 19:59
  • 1
    \$\begingroup\$ If you figured out the answer to your own question, go ahead and answer it with any whys you may have found. That way other people who have the same question will be able to look here for reference. \$\endgroup\$
    – Lunin
    Commented Oct 16, 2012 at 22:14

1 Answer 1

3
\$\begingroup\$

I didn't have enough rep points to post the answer. But I figured out that doing a simple rotation about the Y was going opposite than what was in Maya. So I figured that adding 180 in the other direction should, and it did:

static Quaternion ConvertToRightHand(Vector3 Euler)
{
    Quaternion x = Quaternion.AngleAxis(-Euler.x, Vector3.right);
    Quaternion y = Quaternion.AngleAxis(-Euler.y + 180, Vector3.up);
    Quaternion z = Quaternion.AngleAxis(Euler.z, Vector3.forward);
    return (z * y * x);
}
\$\endgroup\$

You must log in to answer this question.

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