PDA

View Full Version : Biped Rotation Mess


kogen
03-29-2012, 06:58 AM
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?

Klunk
03-29-2012, 08:11 AM
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 ?

kogen
03-29-2012, 08:49 AM
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?

ClaudioAlvaro
03-31-2012, 04:47 AM
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.

kogen
03-31-2012, 09:01 AM
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...

kogen
04-11-2012, 06:12 AM
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

huijun
04-12-2012, 02:34 AM
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 -> ..

CGTalk Moderation
04-12-2012, 02:34 AM
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.