Jump to content
  • Advertisement
Sign in to follow this  
horace3d

maya bone animation export script

This topic is 4681 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

i work on a bone animation export script with maya. after a lot of trial and error i got it working but there is still one problem. the format i export to has the z-axis up and maya has the y-axis up. my exported model animates perfectly well but it's lying on the floor. i tried to use a matrix to convert the coordinate systems but i didn't get it working. it alwas resulted in garbled animations. i am a bit lost here! i also would like to have the possibility to scale the whole model but with the scale_matrix i had the same problems.
matrix $scale_matrix[4][4] = << $scale, 0, 0, 0; 0, $scale, 0, 0; 0, 0, $scale, 0; 0, 0, 0, 1 >>;
matrix $yup_to_zup[4][4] = << -1, 0, 0, 0; 0, 0, 1, 0; 0, 1, 0, 0; 0, 0, 0, 1 >>;

for ($joint in $joint_hierarchy)
{
   currentTime(0); // switch to bind pose

   matrix $m1[4][4] = m4x4(getAttr($joint + ".inverseMatrix"));
   matrix $offset1[4][4] = m4x4(getAttr($joint + ".worldInverseMatrix"));
   matrix $offset2[4][4] = m4x4(getAttr($joint + ".worldMatrix"));

   currentTime($frame); // switch to current animation frame

   matrix $m2[4][4] = m4x4(getAttr($joint + ".matrix"));
			
   matrix $m[4][4] = $m2 * $m1;
   $m = $offset1 * $m * $offset2;

   // write final animation matrix $m to file
}
this is how i have to construct the animation matrix. maybe some of you have an idea how to bring in my yup_to_zup and scale_matrix here? :)

Share this post


Link to post
Share on other sites
Advertisement
why can't you simply exchange the y and z values for all points? any matrix you have, you would simply exchange the respective columns or rows depending on the format (row or column vectors).

Tim

Share this post


Link to post
Share on other sites
I can't entirely follow your code, perhaps your matrix multiplication is in the wrong order(reversed) your idea is right I think. if you do it this way you'd want to make sure your ytoz matrix is the LAST operation appiled.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!