Archived

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

jtech

Mirroring a skeleton

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