Exporting bones: get object rotation relative to parent in MaxScript

Exporting bones: get object rotation relative to parent in MaxScript

Anonymous
Not applicable
1,593 Views
0 Replies
Message 1 of 1

Exporting bones: get object rotation relative to parent in MaxScript

Anonymous
Not applicable

I'm exporting bones from 3ds max model using maxscript.

I need a bone rotation relative to parent, so I'm using node transform to get it (as advised here and here😞

(bone.transform * (inverse bone.parent.transform)).rotation

The problem may be illustrated by the following junction in two sequential frames:

Frame 1Frame 1

Frame 2Frame 2

All other objects in the scene are hidden.

 

Here the angle between bones is altered by approximately 9 degrees when passing from frame1 to frame2. Horizontal bone is parent, but it's transformed by it's parents respectively. Thus, parent bone's transform is not identity and it differs significantly between frame1 and frame2.

 

The problem is that the above formula yields (axis [0,1,0], angle 118.349) for frame1 and (axis [0,-1,0], angle 233.877) for frame2. Slerp of such quaternions rotates the bone to the left, along the big arc of 351 (which is 360 - 9) degrees. It's wrong, and it's what I see in the model importing program. But when I press play in 3ds Max, the bone is rotated only by 9 degrees, as expected.

 

Both of these bones are controlled by IK controller, and many other bones of the model are controlled by other various controllers. I suppose that rotation used by 3ds max is taken from controllers, and it's different from what I get when using node transformations.

 

So what is the right way to get parent-relative rotation of a node?

 

0 Likes
1,594 Views
0 Replies
Replies (0)