Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 :/

share|improve this question
    
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); } –  Hector Llanos Oct 16 '12 at 19:59
    
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. –  Lunin Oct 16 '12 at 22:14
add comment

1 Answer

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);
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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