PDA

View Full Version : MEL script problem


Jagger
04-20-2003, 09:52 AM
Hey guyís im having a problem setting up an expression for a rig and im hoping one of you can give me an idea on how to approach this.

I have an expression that works fine but I only want it to work when a controller is "not" moving (translate Z).

The problem is I donít know how to tell Maya to check if the controller is moving or not.

The only way I could think of setting this up was through something like this:

If controler.translateZ at current frame = controler.translateZ at next frame then expression = true

Unfortunately I donít know how to make the relationship between the translate and the frame.

If that isnít enough information, this is for an expression driven walk. This particular problem concerns the translate Y of my leg controller. Iíve set it up so all you have to do is move the legs forward and every thing else compensates for you.

The way I have the translate Y for my l_leg controller (IK) set up is like this:

$dif = (r_leg_controler.translateZ - l_leg_controler.translateZ);
if ($dif < 0)
{
$dif = -($dif);
}
l_leg_controler.translateY = -(($dif) -10)/1.5

Now this gives me a nice ark for the left leg when it steps forward, and it plants properly. But it repeats when the right leg comes forward which isnít right because at that point the left leg should be the balancing leg.

Working with this, I know the bend should only occur when the opposite leg is planted (no translate Z) and deactivated when the opposite leg is translating (stepping forward).

Any ideas?

larryvm
04-21-2003, 07:01 PM
the easy way in add an attribute like oldTranslateZ

and
the script will be more or less

if ((frame()!=0) && (oldTranslateZ!=translateZ))
{
do the thing
}

oldTanslateZ=translateZ;

Jagger
04-23-2003, 03:04 AM
thanx larryvm, works like a charm :)

CGTalk Moderation
01-14-2006, 11:00 PM
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.