Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

[Biped] Get/Set transform discrepancy on certain limbs.

[Biped] Get/Set transform discrepancy on certain limbs.

wolvawab
Enthusiast Enthusiast
736 Views
4 Replies
Message 1 of 5

[Biped] Get/Set transform discrepancy on certain limbs.

wolvawab
Enthusiast
Enthusiast

Hi everyone,

A bit of a noob question here, but I've been unable to properly rotate fingers in toes in biped via scripting.

I am in figure mode whilst doing this, here is a sample script to illustrate this:

import pymxs
rt = pymxs.runtime

bone = rt.getNodeByName('Bip001 R Finger0')
boneQuatRot = rt.biped.getTransform(bone, rt.Name('rotation'))
print(boneQuatRot)
printedQuat = rt.quat(-0.128228, -0.589822, 0.279608, 0.74665)
rt.biped.setTransform(bone, rt.Name('rotation'), printedQuat, False)

Here, I am fetching one of the finger's rotation using getTransform, which from what I read in the docs is the "recommended" way to do it with biped. "printedQuat" is literally me constructing a quaternion based off what was printed from the previous line.
If I manually rotate the bone in the viewport and re-run this script, the bone is properly rotated back to its initial transforms... However the rotation axis is completely skewed, as you can see in the video attached.
I am only able to repro this on fingers and toes, this doesn't occur on any other bone in the hierarchy.

My gut feeling tells me that I am missing something... Probably obvious stuff. 😅

0 Likes
737 Views
4 Replies
Replies (4)
Message 2 of 5

denisT.MaxDoctor
Advisor
Advisor

I don't see anything in your code that would screw the axis...

try a simple MXS test:
 

 

q = biped.gettransform $ #rotation
biped.settransform $ #rotation q false

 

 

where $ is selected Finger0 

 

It must work as expected 

 

0 Likes
Message 3 of 5

wolvawab
Enthusiast
Enthusiast

Thank you for the swift response Denis!
Your example works fine, and I've already achieved this in Python, allow me to break-down the repro steps in a little bit more detail:

1. Execute the following code to retrieve the current rotation on the bone:

 

import pymxs
rt = pymxs.runtime

bone = rt.getNodeByName('Bip001 R Finger0')
boneQuatRot = rt.biped.getTransform(bone, rt.Name('rotation'))
print(boneQuatRot)

 

2. Copy the result from the Scripting Listener, in my case this is represented by the following variable. (this is not a random quaternion, it is the current rotation just like in your max script example)

 

printedQuat = rt.quat(-0.128228, -0.589822, 0.279608, 0.74665)

 

 3. Now in the viewport, rotate this particular bone by hand.
4. Finally, execute the setTransform command with the quaternion we just gathered (representing the initial rotation):

 

rt.biped.setTransform(bone, rt.Name('rotation'), printedQuat, False)

 

You should see the bone rotating back to its initial position as expected, however, if you try to rotate it by hand (in Local Space in my case), you'll see the unwanted results I am describing just like in the video I attached to my initial post.

0 Likes
Message 4 of 5

denisT.MaxDoctor
Advisor
Advisor

I followed all your steps but could not reproduce the problem..... everything works as it should. (both MXS and Python)

0 Likes
Message 5 of 5

denisT.MaxDoctor
Advisor
Advisor

#1. let's work with the same test skeleton:

 

 

delete objects
bip_root = biped.createNew 177 -90 [0,0,170] arms:true neckLinks:1 spineLinks:3 legLinks:3 fingers:5 fingerLinks:3 toes:1 toeLinks:1 trianglePelvis:on  

 

 

 

#2. do all rotations at frame 0

#3. no extra animation (no keys)

 

0 Likes