PDA

View Full Version : Parameter Wiring in Max 8, recording local rotations


kidcanuck
12-05-2006, 09:33 PM
Hi to all in the forum,

I'm having troubles with a character rig. Basically I'm having helper objects at the joints of the rig drive morph target values that tune the deformations and add a little bit of muscle movement.

The problem I'm having is in gathering the rotational information from the helper objects. I'd like to have it based off local rotation but that doesn't happen. If I take the master controller and rotate it 90 degrees to make the character lie on a bed for example, it activates the morph targets just the same as if I rotated the elbow 90, etc... Each helper object is linked to the parent bone, example: thigh and has an orientation contsraint to the child bone ie: shin.

Here is the parameter wiring expression I'm using to tie the helper object's rotation to the morph target value:

constant = 1.7212
angle = in coordsys local (Rotation as eulerAngles).x
morph = _1__Female_R_Knee___Target_Available_ as string

If (angle == 0 or angle == 180) then morph = 0
Else if (angle < 0) then morph = (180 + angle) * constant
Else if (angle > 0) then morph = 0

Any suggestions on how I might tune this? Thanks.

visionIII

Illusion-shadow
12-06-2006, 12:10 AM
Okay, Here is how I think you should record the local rotational value. What you need to do is use the Expose TransformHelper to record your local Euler Angles.

For exsample:

Create two dummies (or points) and aglin dummy1 and dummy 2 with position and roation. Then create a exposeTM helper and place it anywhere in the scene. In the expose Node Parameters, pick the dummy1 to be the node and dummy2 to be the local reference node. Now the local value of dummy1 will be in the Local Eurler Angles group in the Exposed Values Rollout. Now whenever you rotation dummy1, it will give you the local rotation value of any axes you want. If you are using expressiion, just use the value in the local euler angles instead of the object's orientation.

eek
12-06-2006, 12:48 AM
The rule is 'Transforms are relative to there parent' if your node is parent then its relative to its parent. If its not parented then its relative to the world.You need to inverse its transform about a node, in this case its it's parent (but it can be relative to any node):

($.transform * inverse $.parent.transform)

Your now getting $ transforms relative to its parent space. If you want to be more specific, you need to put it into parenthesis and give it an parameter for example:

(($.transform * inverse $.parent.transform) as eulerangles).x
(quatToEuler ($.transform * inverse $.parent.transform))


The red its transforming the objects space into its parent space , the yellow is its parameter your accessing and the purple is an attribute of that parameter.

Now when dealing with rotations make sure you understand how max interpolates rotations i.e radians and degrees. For instance you may need to use degToRad (degrees to Radians).

So for you, its something like this (using an expression controller on the morph slider itself):



I'd write this as an expression or script controller or a CA for example:


n(constant)
1.7212


node(node)
angle = degToRad((node.transform * inverse node.parent.transform) as eulerangles).x

if ((angle < 0),180+angle,0)

You could also use a modular function or clamp.

cheers,

kidcanuck
12-06-2006, 06:00 PM
Thanks for the quick responses, you guys rock. I have played with both solutions and went with illusion-shadow's. Handy little tool that ExposeTM Helper, I had never used it before this project and it does just what I need for this project.
For the code based solution, I think I get what you were getting at theoretically, but somewhere I missed a step in the syntax. I'm still pretty new to all of this advanced rigging and we didn't even cover a blink of scripting in school. It can be tough learning this stuff on your own, so I appreciate the help. How exactly does the inverse function work when used with transforms and rotations?

Well back to the grind. Thanks again.

visionIII

eek
12-07-2006, 03:25 AM
As with the 12 principles of animation, parenthesis and transform space in rigging as fundemental to understand. Every object in max and most 3d programs work with in a transform space, essentially they are relative to an origin. For example lets take the earth as an analogy:

The earth itself has no parent therefore its true parent or world root is the world origin itself: the sun. I.e when the earths position is at [0,0,0] then it is at the origin (suns position)

Now the moon is parented to the earth and therefore its origin at [0,0,0] is the position of the earth. When the position is eg [10,0,0] this is an offset from the earth position along the x axis.

What inverse does is transform an objects existing space, into another. So if i was to do:

moon.transform * inverse sun.transform - the moons transforms are relative to the suns now.


Edit:

The other thing i forgot was that controllers are generally in local space eg. node.pos.controller.x will be relative to its parent. Whereas node.transform is world space. This however gets a little tricky with position constraints - there a little quirky.

CGTalk Moderation
12-07-2006, 03:25 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.