Notifications
Clear all

[Closed] biped.setTransform

I am working on a script that animates a biped according to a bone setup using biped.setTransform. Everything works well until the scene is saved. Then, certain biped parts no longer set their transforms appropriately, most noticeably the spine. Does anyone know what might be occuring that would cause a scene save to affect biped in this way?

Thanks,
Jon

8 Replies

This is making me cry a bit too. I can extract the bipeds positions using get/set transform but the pelvis only seems to extract one rotation – (y) I guess this must go back to where the pelvis was more limited in rotation in previous releases of CS. As for any rotation moving backwards and forward etc, i cant seem to get the data for that. Top of my head would suggest to use copy/paste posture to get and set the pelvis position, but that’s pretty slow and ugly. there has to be a better way!

Forgive me for jumping in on this thread, but this is kind of what I’m trying to do.

I don’t understand why doing this:

rotcont = biped.getnode $ #head
mytest = biped.getTransform rotcont #rotation
biped.settransform rotcont #rotation mytest true

changes the rotation of the head. Are these things additive? IOW, if you perform a Get and return the current quat values of the head and then turn around and apply them, why does the head rotate?

What I’d like to do is apply the rotations of another object to the biped head, and it seems to work except for this weird rotation issue (which is to say that I can get the rotations applied to the head except it turns around backwards and lays on its side, which so far isn’t very useful to me :>)

Hello,

I’m not sure if this is what you’re looking for, but here is a script I use for applying transforms from an imported bone rig to a biped (matching in size).

rollout B2BRollout "Bone2Biped"
  (
    button B2BButton "Apply Animation"
  
    On B2BButton pressed Do
    (
  	anim_Start = animationRange.start
  	anim_End = animationRange.end
  	DisableSceneRedraw()
  	Animate On
  	For t = anim_Start to anim_End Do
  	(
  	  sliderTime = t
  	  biped.setTransform $Bip02 #pos ($Bip01.transform.pos) True
  	  biped.setTransform $Bip02 #rotation ($Bip01.transform.rotation) True
  	  biped.setTransform $'Bip02 Pelvis' #pos ($'Bip01 Pelvis'.transform.pos) True
  	  biped.setTransform $'Bip02 Pelvis' #rotation ($'Bip01 Pelvis'.transform.rotation) True
  	  biped.setTransform $'Bip02 Spine' #pos ($'Bip01 Spine'.transform.pos) True
  	  biped.setTransform $'Bip02 Spine' #rotation ($'Bip01 Spine'.transform.rotation) True
  	  biped.setTransform $'Bip02 Spine1' #pos ($'Bip01 Spine1'.transform.pos) True
  	  biped.setTransform $'Bip02 Spine1' #rotation ($'Bip01 Spine1'.transform.rotation) True
  	  biped.setTransform $'Bip02 Spine2' #pos ($'Bip01 Spine2'.transform.pos) True
  	  biped.setTransform $'Bip02 Spine2' #rotation ($'Bip01 Spine2'.transform.rotation) True
  	  biped.setTransform $'Bip02 Neck' #pos ($'Bip01 Neck'.transform.pos) True
  	  biped.setTransform $'Bip02 Neck' #rotation ($'Bip01 Neck'.transform.rotation) True
  	  biped.setTransform $'Bip02 Head' #pos ($'Bip01 Head'.transform.pos) True
  	  biped.setTransform $'Bip02 Head' #rotation ($'Bip01 Head'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Clavicle' #pos ($'Bip01 L Clavicle'.transform.pos) True
  	  biped.setTransform $'Bip02 L Clavicle' #rotation ($'Bip01 L Clavicle'.transform.rotation) True
  	  biped.setTransform $'Bip02 L UpperArm' #pos ($'Bip01 L UpperArm'.transform.pos) True
  	  biped.setTransform $'Bip02 L UpperArm' #rotation ($'Bip01 L UpperArm'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Forearm' #pos ($'Bip01 L Forearm'.transform.pos) True
  	  biped.setTransform $'Bip02 L Forearm' #rotation ($'Bip01 L Forearm'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Hand' #pos ($'Bip01 L Hand'.transform.pos) True
  	  biped.setTransform $'Bip02 L Hand' #rotation ($'Bip01 L Hand'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Finger0' #pos ($'Bip01 L Finger0'.transform.pos) True
  	  biped.setTransform $'Bip02 L Finger0' #rotation ($'Bip01 L Finger0'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Finger01' #pos ($'Bip01 L Finger01'.transform.pos) True
  	  biped.setTransform $'Bip02 L Finger01' #rotation ($'Bip01 L Finger01'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Finger1' #pos ($'Bip01 L Finger1'.transform.pos) True
  	  biped.setTransform $'Bip02 L Finger1' #rotation ($'Bip01 L Finger1'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Finger11' #pos ($'Bip01 L Finger11'.transform.pos) True
  	  biped.setTransform $'Bip02 L Finger11' #rotation ($'Bip01 L Finger11'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Finger2' #pos ($'Bip01 L Finger2'.transform.pos) True
  	  biped.setTransform $'Bip02 L Finger2' #rotation ($'Bip01 L Finger2'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Finger21' #pos ($'Bip01 L Finger21'.transform.pos) True
  	  biped.setTransform $'Bip02 L Finger21' #rotation ($'Bip01 L Finger21'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Clavicle' #pos ($'Bip01 R Clavicle'.transform.pos) True
  	  biped.setTransform $'Bip02 R Clavicle' #rotation ($'Bip01 R Clavicle'.transform.rotation) True
  	  biped.setTransform $'Bip02 R UpperArm' #pos ($'Bip01 R UpperArm'.transform.pos) True
  	  biped.setTransform $'Bip02 R UpperArm' #rotation ($'Bip01 R UpperArm'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Forearm' #pos ($'Bip01 R Forearm'.transform.pos) True
  	  biped.setTransform $'Bip02 R Forearm' #rotation ($'Bip01 R Forearm'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Hand' #pos ($'Bip01 R Hand'.transform.pos) True
  	  biped.setTransform $'Bip02 R Hand' #rotation ($'Bip01 R Hand'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Finger0' #pos ($'Bip01 R Finger0'.transform.pos) True
  	  biped.setTransform $'Bip02 R Finger0' #rotation ($'Bip01 R Finger0'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Finger01' #pos ($'Bip01 R Finger01'.transform.pos) True
  	  biped.setTransform $'Bip02 R Finger01' #rotation ($'Bip01 R Finger01'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Finger1' #pos ($'Bip01 R Finger1'.transform.pos) True
  	  biped.setTransform $'Bip02 R Finger1' #rotation ($'Bip01 R Finger1'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Finger11' #pos ($'Bip01 R Finger11'.transform.pos) True
  	  biped.setTransform $'Bip02 R Finger11' #rotation ($'Bip01 R Finger11'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Finger2' #pos ($'Bip01 R Finger2'.transform.pos) True
  	  biped.setTransform $'Bip02 R Finger2' #rotation ($'Bip01 R Finger2'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Finger21' #pos ($'Bip01 R Finger21'.transform.pos) True
  	  biped.setTransform $'Bip02 R Finger21' #rotation ($'Bip01 R Finger21'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Thigh' #pos ($'Bip01 L Thigh'.transform.pos) True
  	  biped.setTransform $'Bip02 L Thigh' #rotation ($'Bip01 L Thigh'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Calf' #pos ($'Bip01 L Calf'.transform.pos) True
  	  biped.setTransform $'Bip02 L Calf' #rotation ($'Bip01 L Calf'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Foot' #pos ($'Bip01 L Foot'.transform.pos) True
  	  biped.setTransform $'Bip02 L Foot' #rotation ($'Bip01 L Foot'.transform.rotation) True
  	  biped.setTransform $'Bip02 L Toe0' #pos ($'Bip01 L Toe0'.transform.pos) True
  	  biped.setTransform $'Bip02 L Toe0' #rotation ($'Bip01 L Toe0'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Thigh' #pos ($'Bip01 R Thigh'.transform.pos) True
  	  biped.setTransform $'Bip02 R Thigh' #rotation ($'Bip01 R Thigh'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Calf' #pos ($'Bip01 R Calf'.transform.pos) True
  	  biped.setTransform $'Bip02 R Calf' #rotation ($'Bip01 R Calf'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Foot' #pos ($'Bip01 R Foot'.transform.pos) True
  	  biped.setTransform $'Bip02 R Foot' #rotation ($'Bip01 R Foot'.transform.rotation) True
  	  biped.setTransform $'Bip02 R Toe0' #pos ($'Bip01 R Toe0'.transform.pos) True
  	  biped.setTransform $'Bip02 R Toe0' #rotation ($'Bip01 R Toe0'.transform.rotation) True
  	  t += 1
  	)
  	Animate Off
  	EnableSceneRedraw()
    )
  )
  CreateDialog B2BRollout width:162 height:30

Best regards,
RX31

First of all, I am aware you may be responding to the others on this thread and not to me – so I hope your script works for them (I did not intend to hijack this thread and apologize for any confusion).

For me (trying to get rotations from another object and apply them to the biped) this script causes the same problem – namely, the biped head immediately lays over on it’s side and turns around 180 degrees.

For those of you playing along at home here’s my relevent code test (with my animated Box01 being what I’m trying to copy the rotations from):

anim_End = animationRange.end
DisableSceneRedraw()

Animate On

  For t = anim_Start to anim_End Do
  (
    sliderTime = t
  biped.setTransform $'Bip01 Head' #pos ($box01.transform.pos) True
    biped.setTransform $'Bip01 Head' #rotation ($box01.transform.rotation) True
  t += 1
  )

Animate Off
EnableSceneRedraw()

Now, based on assuming that what you do works for you, this leads me to the conclusion that it has to do with the hierarchy of the biped structure – that is, your code works because you are copying the exact same hierarchy and this can’t be applied from an unlike structure. Can I ask if the rig you are using (Bip01, in this case) is created with Max bones?

Hello,

Yes, Bip01 is max bones which match exactly with Bip02 in length. Perhaps you’ll have more control if you attach your box to max bones, which match your biped and use this script.

Best regards,
RX31

Thanks, yes indeed using just two Max bones will work correctly with Biped (although they also need to be aligned correctly with the biped head, but that’s no big deal). So it solves my problem (mucho thanks) although it also shows just how quirky Biped is.

In any case, I’m working now (and I’m sure you all know how great it is to be able to say that :>)

So I’ve narrowed down the problem a bit. It seems that if you rotate biped’s first spine link in figure mode, then save the max file or a .fig file, you can no longer set accurate rotations on that spine link. To recreate the effect you can follow these steps:

  1. create a biped in the front viewport
  2. turn on figure mode
  3. rotate the 1st spine link forward
  4. turn off figure mode
  5. create a dummy and align it to the 1st spine link
  6. type in the listener:

biped.setTransform $‘Bip01 Spine’ #rotation $Dummy01.transform.rotationpart false

The spine will stayed aligned to the Dummy, now save the file and execute the same line in the listener and the spine will jump. If anyone has any clues on why this is happening or any work arounds, I’d really appreciate it. Thanks

I did the same in 3ds Max 2016 and the undo buffer was not deleted.