Natural IK Chain

So shared this video series from Yutaca Sawai:

I decided to test it, and quickly made a script to generate a chain of n-segments
Essentially the left chain is the important one (bold in the video) and the rest are just a construct to propagate a single rotation to a full fletched motion.

Open Maya, run this Python script, see for yourself how one rotation and a bunch of parented joints & ikhandles can generate complex motion!

def joint(x,y,z):
    jt = cmds.joint()
    cmds.xform(jt, t=[x,y,z], ws=True)
    return, l=True)[0]
def ikHandle(start, end):
    sl =, end)
    ikh = cmds.ikHandle()[0]
    return ikh

def constructBase(cycles = 10):
    rotator = joint(1,0,0)
    #demonstrative animation
    cmds.setAttr('%s.rz'%rotator, 360)
    cmds.playbackOptions(min=0, max=60)
    root = joint(0,1,0)
    chain2root = joint(-2,-1,0)
    anchor = joint(0,-3,0), anchor)) #group to make the ik handle fixed in place
    #chain 1
    ikGroups1 = []
    parents1 = []
    for i in range(cycles):
        ikGroups1.append([joint(2,-1 - i * 8,0)])
        joint(2,-5 - i * 8,0)
        ikGroups1[-1].append(joint(-2,-5 - i * 8,0))
        parents1.append(joint(-2,-9 - i * 8,0))

    #chain 2
    ikGroups2 = []
    parents2 = []
    for i in range(cycles):
        parents2.append(joint(-2,-5 - i * 8,0))
        ikGroups2.append([joint(2,-5 - i * 8,0)])
        joint(2,-9 - i * 8,0)
        ikGroups2[-1].append(joint(-2,-9 - i * 8,0))
    for i in range(len(ikGroups2)):
        cmds.parent(ikHandle(*ikGroups2[i]), parents1[i])
    for i in range(len(ikGroups1)):
        cmds.parent(ikHandle(*ikGroups1[i]), parents2[i])


Leave a Reply

Your email address will not be published. Required fields are marked *