additive matrices?

Started by
3 comments, last by supagu 20 years, 9 months ago
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.
Advertisement
I think if you showed us what you were doing for code it would help a bit more.

~Rob
"The difference between insanity and genius is measured only by success."~Bruce Feirstein
You want to multiply the child''s rotation matrix with the parent''s world transformation matrix (I think). Matrix multiplication is not communitive.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
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 classD3DXMATRIXA16 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)
yeah multiply works i just had some "pointer poo" :-/

This topic is closed to new replies.

Advertisement