Stretching IK Leg


#1

Hi everyone, i’m working on a rig following the tutorial Creating a Comprehensive Character Rig from Maya Learning Channel. I made the left IK leg rig perfect, is stretching, but I’m doing the right leg and when i used the same Mel script, it doesn’t work, I think maybe is because the Translation X in the left is positive and in the right is negative, I need help with that.

This is the script:

string $driver = “dist_l_length_IK0Shape1.distance”;
float $leftThighLength = getAttr jDrv_l_knee_IK01.translateX;
float $leftKneeLength = getAttr jDrv_l_ankle_IK01.translateX;
float $sumLength = $leftThighLength + $leftKneeLength;
setDrivenKeyframe -currentDriver $driver -driverValue $sumLength -attribute “translateX” -value $leftThighLength jDrv_l_knee_IK01;
setDrivenKeyframe -currentDriver $driver -driverValue ($sumLength2) -attribute “translateX” -value ($leftThighLength2) jDrv_l_knee_IK01;
setDrivenKeyframe -currentDriver $driver -driverValue $sumLength -attribute “translateX” -value $leftKneeLength jDrv_l_ankle_IK01;
setDrivenKeyframe -currentDriver $driver -driverValue ($sumLength2) -attribute “translateX” -value ($leftKneeLength2) jDrv_l_ankle_IK01;

That’s for left Leg, of course I substitute the left for the right and the “l” for the “r”.
The answaer me an tell me that I need to multiply the various stretch equations by -1, but muy question is where exactly in the equation i have to multiply by -1.
Hope you can help me.


#2

The distance will always be positive so you don’t need to multiply the driverValue, instead multiply the value by -1.