[Closed] Bone Matrix Problem
Hi,
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
Dan
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 ) )
This is so weird! It works perfectly on other types of hierarchys like point helpers or geometry chains. Its something about it being bones.
make sure you are either
- setting the matrix in parent space
- setting the tranform for the root down… i.e start at the first bone in the chain and then do its children,… ect…
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
Dan