View Full Version : 2 Quick Stretchy IK questions

 wrstrader11 November 2008, 07:14 PMI have looked all over trying to find an answer to my questions and so far have been unsuccessful in finding any answers, so I thought I'd post them. Hope I'm not beating a dead horse. When I make my stretchy IK, I use the Art of Rigging method of point constraining empty groups to the base joint and IK handle, then use a combination of distanceBetween, multiplyDivide, and conditional nodes to get the correct amount to scale by, then plug them into the scale X of the joints. For some reason, the joints go crazy when I do this. To fix this, I have to plug the amount to scale by into only the base joint scale X, then connect the base joint scale x to the rest of the joints. Why is this? This is more MEL than rigging related, but my other question is script specific. Here are the relevant parts of the script: proc string makeMultDiv (string \$distBetwNode, float \$jointDist) { string \$multDivNode = `shadingNode -asUtility multiplyDivide`; setAttr (\$multDivNode + ".operation") 2; setAttr (\$multDivNode + ".input2X") \$jointDist; connectAttr -f (\$distBetwNode + ".distance") (\$multDivNode + ".input1X"); print \$multDivNode; return \$multDivNode; } string \$ikToMakeStretchy = \$ikSelection[0]; float \$jointDist = `findJointDistance (\$ikToMakeStretchy)`; string \$distBetwNode = `makeDistBetwNode (\$ikToMakeStretchy)`; string \$myDivNode = `makeMultDiv (\$distBetwNode, \$jointDist)`; When I call the makeMultDiv procedure, it gives me a syntax error on the line that says: string \$myDivNode = `makeMultDiv (\$distBetwNode, \$jointDist)`; Anyone have any idea why? Any feedback is appreciated. I got my stretchy IK script working, I'm just wondering why it wouldn't let me structure it the way I wanted.
edwardG
11 November 2008, 06:00 AM
proc string makeMultDiv (string \$distBetwNode, float \$jointDist)
{

I don't think you need to add "string" into the proc name and it is probably the reason for the error.

As for your other question, if you are using Maya 2008 or higher and are trying to execute the script included on the DVD, I think that there is a small part of the script that you need to change in order to get it to read properly in that version, though I forget which part it is (perhaps I'm thinking of the Dynamic IK script...).

I'll look into it some more and try to find an answer for you.

d-brooks
11 November 2008, 10:01 AM
The 'string' in the proc definition is correct. It specifies the return value.

tonytouch
11 November 2008, 08:34 PM
maybe you need to make it

global proc string .... ( i am not sure , usually it should work /( i see no error in the script )

----------------

but for

you can also use ( btw )

createNode mulitplyDivide -n (\$name + "_div");
setAttr (\$name + "_div.operation") 2;

// or some other nodes

createNode plusMinusAverage -n (\$name + "_plus");
createNode distanceBetween -n (\$name + "_dist");
createNode reverse -n (\$name + "_rev");
createNode condition -n (\$name + "_cond");
createNode remapValue -n (\$name + "_remap");
createNode blendColors -n (\$name + "_blend");
createNode blendTwoAttr -n (\$name + "_blend");
createNode multDoubleLinear -n (\$name + "_mult");

i am a bit unhappy myself , that there is no sinus , cosinus or fmod-node in maya

----------------------------------

personally i would recommend , not to use the scaleX .... but to use the translateX-value of the "next"joint in the chain and just build in one more multiplication with the "initial Length" of the upper and lower-arm/leg -joint .

e.g. in order to scale the upperarm-joint , increase the translateX-value of the elbow-joint - but you can use both methods ... for my rigs , i always used to scale the joints as well - as in art of rigging book - but right now , i am about to switch to translate_stretch my skeleton , as i get a better deformation that way

( scale_stretch vs translate_stretch ) - but that depends on you