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