Lost Adventurer, Aleks Kirilenko (3D)
LC #42 Pipers Alley

View Full Version : Bone Matrix Problem

03-03-2009, 11:28 PM

I got a fairly simple script that mirrors a transform matrix for each bone in a chain and applys the mirrored transforms to an opposite bone chain. Unfortunatly it always seems to flip the last bone in the opposite chain at a strange angle. I'm missing something fundermental I think as I can't see what causes the strange flip.

it would be great if someone could explain whats happening here. I have attached a sample scene and the script.

Thanks in advance


redChain = #($BN_R_01,$BN_R_02,$BN_R_03)
blueChain = #($BN_L_01,$BN_L_02,$BN_L_03)

fn mirrorMatrix inMatrix MirrorObj Axis =

case Axis of
1: Flip = scalematrix [-1,1,1]
2: Flip = scalematrix [1,-1,1]
3: Flip = scalematrix [1,1,-1]

FinalTM = ((((matrix3 1) * Flip)* (inMatrix * inverse MirrorObj) ) * Flip) * MirrorObj
) -- End MirrorMatrix

for i = 1 to redChain.count do( blueChain[i].transform = ( mirrorMatrix redChain[i].transform $mirror_point.transform 1 ) )

03-04-2009, 02:21 PM
This is so weird! It works perfectly on other types of hierarchys like point helpers or geometry chains. Its something about it being bones.

03-04-2009, 04:16 PM
make sure you are either
1. setting the matrix in parent space
2. setting the tranform for the root down... i.e start at the first bone in the chain and then do its children,... ect...

03-04-2009, 04:43 PM
Cheers Mark,

At the moment its doing its stuff in the world space so I will look into setting in parent space.

Hopefully thats the cause. Its so strange that bones seem to behave different to other object chains. Theres no Ik on the bones its all FK.

Thanks again


CGTalk Moderation
03-04-2009, 04:43 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.