IK

How does the Ik Solver work?

The attribute preferred angle serves two purposes from my POV.

First, it gives the solver an idea around which angle or rather axis a joint is

supposed to be rotated about from the user. Second, during the solve the

preferred angle is used as a starting point for the solver. As usually this results in a plane defined by

the start joint, the effector and the ikHandle, the solver has a good starting point

to calculate a unique solution. Of course there are cases where this doesnt

work and for those the ultimate tool is a pole vector, ´given it is positioned

properly in space. I guess technically Point 1 and 2 are technically identical but that is how I

can make sense of this attribute. Also this may explain why when joints are at an

angle when you add IKs you do not need to set the preferred angle attribute as Maya

can figure it out. (Jan Berger)

Pole Vector Calculation, two joint chain

How does the `ikHandle` command set up the initial pole vector? It

seems to take the vector between the start joint and it's position and

cast a vector orthogonal to it in the direction of the mid joint. I've

found code showing me how to calculate orthogonal vectors, but none

showing me how to do it when you only have one vector (the end joint -

the start joint). How do I get the other two axis and determine which

one to use for the pole vector?

Pole Vector Calculation (thread on p.i.m.)

How do you calculate Pole Vector Position for Non-straight arm?

Useful Pole Vector Thread

//select elbow and it will place a locator suitably { string $joint[],$child[]; float $pos[],$pos2[],$mult; $mult=2; $joint=`ls -sl -tl 1`; $child=`listRelatives -children -type joint $joint[0]`; $locator=`spaceLocator`; $pos= `xform -q -t -ws $joint[0]`; $pos2=`xform -q -t -ws $child[0]`; xform -ws -t ($mult*$pos[0]-$pos2[0]) ($mult*$pos[1]-$pos2[1]) ($mult*$pos[2]-$pos2[2]); }

http://forums.cgsociety.org/archive/index.php/t-722543.html

How do you make lines from Pole Vector to joint?

Make single ep curve that only has two point. Cluster the start and end point. Constrain the appropiate cluster to either the pole control or the knee joint.

(K. Figgins)

Stretchy Ik

-- not particular to spine, but filing under for now.

-node to get curve length is 'arcLengthDimension'

// Measure the arcLength of curve curveShape1 at u = 0.5

curve -d 3 -p -9.3 0 3.2 -p -4.2 0 5.0 -p 6.0 0 8.6 -p 2.1 0 -1.9 -k 0 -k 0 -k 0 -k 1 -k 2 -k 2;

arcLengthDimension curveShape1.u[0.5];

problem with arcLengthDimension, it will make WORLD/global scale difficult if you are piping the va. back into the scale.

OR 'curveInfo' node..

Create curveInfo node with:

arclen -ch 1;

Muscle spline rigging tool (Autodesk help)

Spline IK

Spline IK Flipping

Building an IK Spline chain on a very non-straight joint chain?

Do not attempt to build your own curve. Check 'Auto-Create Curve', make sure 'Auto-Simplify Curve' is unchecked.

IK/FK

Create a switchable IK/FK character rig in Maya (1 of 12) :

http://www.youtube.com/watch?v=KNfSG1DEj58

*****************

I have one control that I'm using to control FK/IK on a leg. I dont want to

have one for IK and one for FK because it gets confusing. Right now I have

reverse foot roll and translate attributes that I want to hide when I'm in

FK mode and vice versa.

Heres the expression in question that will disable translateX but wont

unhide switch into IK.

Thanks!!!!

import maya.cmds as cmds

import maya.mel as mel

mel.eval('proc hideStuff(){setAttr -k 0 "legCtrl1.tx";}')

mel.eval('proc showStuff(){setAttr -k 1 "legCtrl1.tx";}')

myExpr = '''

if (legCtrl1.fkik == 0)

{

hideStuff();

}

else if (legCtrl1.fkik == 1)

{

showStuff();

}

'''

cmds.expression(string=myExpr)

(B. Jones)

I feel like an expression may not be the best spot for this functionality. Wouldn't that imply that it would only get evaluated when the time changes or the node is dirty? It seems to me what you want is a trigger that reacts to actually changing your "fkik" setting.

A script job probably suits the situation better:

##

def toggleStuff():

val = cmds.getAttr('legCtrl1.fkik')

if val == 0:

cmds.setAttr('legCtrl1.tx', k=False)

elif val == 1:

cmds.setAttr('legCtrl1.tx', k=True)

jobId = cmds.scriptJob(attributeChange=['legCtrl1.fkik', toggleStuff])

##

This will immediately react to the change of your fkik attribute, and run a python function that can check and change your attributes.

(J. Israel)