Jump to content
  • Advertisement
Sign in to follow this  
Inactive Cargo

Extraction XYZ and YPR from D3DXMATRIX

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

Hey all, I've been poking around with Direct3D for about a month now, and I'm wondering how you get the position (XYZ) and rotation (YPR) out of a compiled matrix. I have a rudimentary skeletal animation system which loads the mesh(es) and animation(s) out of a .x file, and then animates it. I've got an artist friend who's made a few models and given them to me to play with, but they're not all centered, so if I load two side by side one might be pointing left and the other one forward. What I want to do is get the root bone's transformation matrix, convert it to an identity matrix and copy the XYZ and YPR values into the world transformation matrix it uses, so everything starts pointing 'forward' and the root is centered at (0, 0, 0), although I don't know if it's a good idea to play with the positioning just yet. I've taken a quick peek into the SDK but I'm not finding the relevant information. I'm sure the information exists in it somewhere, but I can't find it. What I would greatly appreciate is if somebody could spell it all out for me (eg provide a simple function that takes a matrix and two D3DXVECTOR3 pointers and puts the apropriate information in them), because I'm a little new to this all. Thanks in advance, Todd

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by DXnut
D3DXMatrixDecompose is the function to use.
Thanks :)

Because I'm stupid, how do I go from the quaternion to YPR? Or is it already quat.y, quat.x, quat.z?

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!