Great IK/FK Switch Tutorial

Here’s a great IK/FK switch tutorial that got me started on the right path for an IK/FK switch. Turns out you really need to use a 3 joint setup or else you run into a LOT of math problems… It’s pretty simple though.

  1. Set up a basic IK chain
    1. I learned recently that if you use a RP solver you don’t need to have rotation at the knee. Again, that makes the math and rotations much cleaner.
  2. Set up a duplicate of that chain. That’s your FK chain.
  3. Duplicate that again. That’s the “bind chain”. This is what will actually drive your character’s clusters.

Then select your upper IK joint, upper FK joint, and upper Bind joint and do an Orient constraint. Create an SDK for an IK_FK value on one of your controls that switches between the two orient weights (1 and 0, 0 and 1). Magic!

That’s it! I made a simple IK to FK snapper that snaps the IK controller to the position and rotation of a locator that’s parented to the wrist of the FK joint chain.

The code could look a bit like this:

import maya.cmds as cmds


def fkToIK():
    cmds.copyAttr("ankle_snapLoc","ik_ctrl",v=1,at=["tx","ty","tz","rx","ry","rz"])
    cmds.copyAttr("elbow_snapLoc","elbow_point",v=1,at=["tx","ty","tz"])
    
def ikToFK():
    cmds.copyAttr("upLeg_ik","upLeg_ctrl",v=1,at=["rx","ry","rz"])
    cmds.copyAttr("lowLeg_ik","lowLeg_ctrl",v=1,at=["rx","ry","rz"])

    
#ikToFK()
fkToIK()

 

Advertisements
Image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s