Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

supagu

additive matrices?

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

what im trying to do is have say a node and a child node, the child node inherits position and rotation from its parent what i tryed is to multiply the parents world transform matrix with the childs world transform matrix, but this seems not to work.

Share this post


Link to post
Share on other sites
Advertisement
I think if you showed us what you were doing for code it would help a bit more.

~Rob

Share this post


Link to post
Share on other sites
You want to multiply the child''s rotation matrix with the parent''s world transformation matrix (I think). Matrix multiplication is not communitive.

Share this post


Link to post
Share on other sites
transform of parent class:


head parent:

D3DXMATRIXA16 matRotation;
D3DXMATRIXA16 matTranslation;
//D3DXMATRIXA16 matWorld; // this is part of the class
D3DXMATRIXA16 matScale;

D3DXMatrixRotationYawPitchRoll( &matRotation, rotation.x, rotation.y, rotation.z);
D3DXMatrixTranslation( &matTranslation, position.x, position.y, position.z);

D3DXMatrixScaling( &matScale, scale.x, scale.y, scale.z);

D3DXMatrixMultiply( &matWorld, &matRotation, &matScale);
D3DXMatrixMultiply( &matWorld, &matWorld, &matTranslation );


children:

//again matWorld is a member variable fo the class
//where parent is a pointer to the parent class
D3DXMATRIXA16 matRotation;
D3DXMATRIXA16 matTranslation;
D3DXMATRIXA16 matScale;

D3DXMATRIXA16 matParent = parent->matWorld;

D3DXMatrixRotationYawPitchRoll( &matRotation, rotation.x, rotation.y, rotation.z);
D3DXMatrixTranslation( &matTranslation, position.x, position.y, position.z);

D3DXMatrixScaling( &matScale, scale.x, scale.y, scale.z);

D3DXMatrixMultiply( &matWorld, &matRotation, &matScale);
D3DXMatrixMultiply( &matWorld, &matWorld, &matTranslation );


children can inherite from other children (im actually trying to do a skeletal/heirachical set up)

Share this post


Link to post
Share on other sites

  • 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!