[Closed] Biped Rotation Mess
Hello guys,
I’m currently working on a script which reduces keyframes in Biped-Tracks.
I’m running into a problem when it comes to understand what biped exactly does.
Imagine that:
In every frame I read the matrix of the appropriate biped node, let’s say forearm. I store the matrix and go to the next frame for this node.
I delete the whole track an start reading the array stepwise (e.g. every 10th key), get the transformation for the bone on this key and apply it again to the node. By saying:
node.controller.value = matrix at keyframe
What I get in the end is a completely messed up biped where neither the position nor the rotation seems to be correct. I checked the array values which are the same values I can see in the transform-type-in window.
Even if I try to extract a matrix.rotationpart or matrix.translationpart using biped.setTransform node #pos etc. it doesn’t work.
So I start asking myself if the matrices are stored in relation to their parent and not in WorldSpace coords as I thought they might?
Has anybody an interesting suggestion?
So I start asking myself if the matrices are stored in relation to their parent and not in WorldSpace coords as I thought they might?
probably the answer ?
I think no. I just set the transformation in the same manner as I get them. Do I have to set them in parent mode?
You need to store the information relative to it’s parent.
if ( bone.parent != undefined ) then
(
storedTransform = bone.transform * inverse ( bone.parent.transform )
)
else
(
storedTransform = bone.transform
)
When reapplying the transform:
if ( bone.parent != undefined ) then
(
bone.transform = storedTransform * bone.parent.transform
)
else
(
bone.transform = storedTransform
)
The information is in the MAXScript help, but it’s deep and not easy to find.
Not sure if I fixed it but one has to get and set all values in World space as the MXS-manual says.
Both biped.getTransform and biped.setTransform use World transformations…
right… biped use tm in world space
try to set in link order
e.g.
… -> clavicle -> upperarm -> forearm -> hand -> …
Ohhh seems like the thread got messed up too.
Thank you Claudio Alvaro, I followed your suggestion and it really worked. That is amazing. I really would like to see that part in the MXS help with my own eyes.
Thanks
kogen