Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   IK Leg stretching (https://simplymaya.com/forum/showthread.php?t=45238)

jesuss196 16-03-2018 11:12 PM

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.

AverageRigger 29-01-2020 02:32 PM

I consumed alot of tutorials on rigging and this channel is one of the better ones on Youtube :happy:

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


All times are GMT. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018