Jump to content
  • Advertisement

Archived

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

jtech

Mirroring a skeleton

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

How would you mirror a skeleton about the Z-axis? Each joint has a position and a rotation relative to its parent.

Share this post


Link to post
Share on other sites
Advertisement
I tried that, but it only seemed to work on some skeletons.
Other skeletons, it only shifted them, not mirror them.

Am I only touching the root matrix:


        
D3DXMATRIX M = D3DXMATRIX( 1,0,0,0,
0,1,0,0,
0,0,-1,0,
0,0,0,1 );

for(int i=0; i < num_bones; i++) {

if(bones[i].parent_index == -1) {
D3DXMatrixMultiply( bones[i].local,
bones[i].local, M );
bones[i].position.z = -bones[i].position.z;
}
}


Is there anything wrong with this? Aside from
any coding typos...

bones.local is the relative rotation matrix,
and bones.position is the relative translation.


[edited by - jtech on October 23, 2002 6:41:08 PM]

Share this post


Link to post
Share on other sites
I found my problem!

But I'm not sure what to do with it.

Both the identity matrix and Z-mirroring matrix convert to
an identity quaternion!

What is the quaternion equivalent of:


      
D3DXMATRIX( 1,0,0,0,
0,1,0,0,
0,0,-1,0,
0,0,0,1 );


It returns (0,0,0, 0.707) but normalized it is (0,0,0,1),
so I am going around in circles.


How do you reflect a quaternion across the z-axis?
I would rather use quats than matrices.


[edited by - jtech on October 23, 2002 8:38:11 PM]

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!