Phone: 905 409-1589
Email: info@penproductions.ca
RSS LinkedIn Twitter Twitter
Tutorials:

Extracting Rotations in 3DS Max:

This is no longer needed in Max 7 and higher as the Expose Transform helper will do this for you.


This tutorial shows how to extract rotations from IK driven joints. it assumes that you have an IK driven leg created.

This was cut and paste from a reply that I posted on the Discreet Max web board at support.discreet.com

What you need to do it extract the rotation of the leg joint using a script controller.

Make sure that you have the thigh bone linked to an object that is aligned orientationaly to the thigh bone. If you don't add a point helper align it to the thigh bone in position and rotation and link the thigh to it and the helper to what ever the thigh was linked to. This is to ensure that the rotation we get it at 0,0,0 as a starting value and isn't flipped in some way that would make the math next to imposible for meer mortals.

Add another point helper and align it to the thigh bone and link it to what ever the thigh is linked to (This could be the point helper that you added in the last step). It really doesn't matter where it is but this makes the most sense.

Change the controller for the for the x.y and z rotation axis to be float script controllers. You don't have to use script to do this but here it is.

$myPointHelper.rotation.x_rotation.controller=float_script()
$myPointHelper.rotation.y_rotation.controller=float_script()
$myPointHelper.rotation.z_rotation.controller=float_script()

In each of the script controllers add this code and change the names as needed.

th=$theThighBone
dependsOn th
rot=(th.transform*inverse th.parent.transform).rotation as eulerAngles
degToRad rot.x

Make sure that you change the line degToRad rot.x to .y and .z respectively for the other axes.

Once you are done this you should be able to wire to the rotation of the point helper and get what is called the local rotation of the thigh bone.

If this all sounds insane I would agree but it is the best way to get the rotation.

If you want to use reactor controllers for driving the joint it will get a little more complex because of a small bug that was missed. If you add a reactor controller to the butt bone and try and pick one of the rotation axes for the point helper you will see that you can't, they are just not available. I have another hoop to jump through to get this to work.

Run this chunk of code in a new script and it will add a custom attribute definition to the $myPointHelper.

ca=attributes rots
(
 parameters rotParam
 (
  xAxis type:#float
  yAxis type:#float
  zAxis type:#float
 )
)
custAttributes.add $myPointHelper ca

Now wire the custom attributes to the rotation axes of $myPointHelper and then you can drive the reactor controllers with the custom attribute parameters.

See how easy it all is :S