Jump to content
  • Advertisement
Sign in to follow this  

Convert rotations from right hand to left hand?

This topic is 4792 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to calculate the rotation values in a left handed system, given the rotation values in a right handed system? HOW? Thanks!

Share this post

Link to post
Share on other sites

I had the same problem with a Maya exporter -> DirectX (Maya = right handed, DirectX = left handed.

For the rotation, I found the following : If you have your rotations around each axis, and applied in the order : X, Y then Z, in a right handed system, then in a left handed system, it will be : X, -Y, -Z.

I did found that in a totally empiric way, but I've been using my exporter since half a year now, and I've never had any problem.

Share this post

Link to post
Share on other sites
Yeh thats what we're doing. Using Maya for our level editor in a DirectX based game. I tried what you said and it doesn't seem to work, can you show me exactly how you grabbed the rotation values from maya? Also, how were you constructing your projection/view matrices in DX? RH or LH?

Share this post

Link to post
Share on other sites
Can you just use a right hand coordinate system instead (rather than converting everything)? We had the same Maya problem, and switching our game to the LH system was pretty painless; 2 steps really (if I remember correctly):

1) Switch the D3DX functions that end in RH to LH
2) Switch the renderstate for culling to the reverse of what you have

I think that's pretty much all I did and never had a problem afterwards. The only downside is that mesh viewer uses a LH system, so it lessens it's value as a tool slightly.

NOTE: This assumes you use the D3DX functions for creating your transform matricies.

Matt Hughson

Share this post

Link to post
Share on other sites
Maya uses RH system though, and we were using D3DX functions to convert between RH and LH in our game. Neither is working for us though. I need help!

Share this post

Link to post
Share on other sites
Ok, here's the function which extract a transformation matrix from a dagPath, and convert it to left handed :

MFnTransform transform(dagPath);
float mat[4][4];
MEulerRotation eulerRotation;
double scale[3];
MVector translation;

// extract the transformations from the transform
translation = transform.translation(MSpace::kWorld);

// convert it to left handed
translation.x = -translation.x;
eulerRotation.y = -eulerRotation.y;
eulerRotation.z = -eulerRotation.z;

// rebuild a transformtion matrix from the modified transformations
MTransformationMatrix transformationMatrix;
transformationMatrix = transformationMatrix.identity;
transformationMatrix.rotateBy(eulerRotation, MSpace::kWorld);
transformationMatrix.setScale(scale, MSpace::kObject);
transformationMatrix.setTranslation(translation, MSpace::kWorld);

// extract the new matrix
MMatrix mayaMatrix = transformationMatrix.asMatrix();

// store it
matrix._11 = mat[0][0]; matrix._12 = mat[0][1]; matrix._13 = mat[0][2]; matrix._14 = mat[0][3];
matrix._21 = mat[1][0]; matrix._22 = mat[1][1]; matrix._23 = mat[1][2]; matrix._24 = mat[1][3];
matrix._31 = mat[2][0]; matrix._32 = mat[2][1]; matrix._33 = mat[2][2]; matrix._34 = mat[2][3];
matrix._41 = mat[3][0]; matrix._42 = mat[3][1]; matrix._43 = mat[3][2]; matrix._44 = mat[3][3];

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!