Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 16-03-2018 , 11:12 PM
Registered User
Join Date: Jul 2010
Posts: 1

IK Leg stretching

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 ($sumLength*2) -attribute "translateX" -value ($leftThighLength*2) jDrv_l_knee_IK01;

setDrivenKeyframe -currentDriver $driver -driverValue $sumLength -attribute "translateX" -value $leftKneeLength jDrv_l_ankle_IK01;

setDrivenKeyframe -currentDriver $driver -driverValue ($sumLength*2) -attribute "translateX" -value ($leftKneeLength*2) 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 29-01-2020 , 02:32 PM
Registered User
Join Date: Jan 2020
Posts: 7
I consumed alot of tutorials on rigging and this channel is one of the better ones on Youtube user added image

Hardcoded within this script it will always look for left sided objects because the names are set like "dist_l_length_IK0Shape1.distance".

"dist_L_length_ ..."

So in order to make the script work for the right side you have to switch out all "_l_" to "_r_" in the script.
I recommend not doing this by hand but by copy the script and paste it into f.e. ms word and do a search&replace so you don't miss any _l_ by accident.

Hope that helps
greets Oliver

Last edited by AverageRigger; 29-01-2020 at 02:39 PM.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads