Home Website Youtube GitHub

IK/FK Hand Ctrl Alignment

Is there a reason why the IK/FK hand controller doesn’t align properly to the arm, every time I build a rig using the template skeleton the IK/FK hand controller doesn’t seem to align to the axis of the arm.

It aligns to the world if I recall correctly. You can fix that in a POST script if you prefer something else.

This is what I add to a POST script. I also swap the order of the ik offset control so the offset is the child. You may not want to do that.

    def run(self, stepDict):
        for side in 'LR':
            self.fix_ik_hand_orientation(side)

    def fix_ik_hand_orientation(self, side):
        handRef = pm.PyNode('hand_{}0_ctl'.format(side))
        ikCns = pm.PyNode('arm_{}0_ikcns_ctl'.format(side))
        ikCtrl = pm.PyNode('arm_{}0_ik_ctl'.format(side))
        handChildren = ikCtrl.getChildren(type='transform')
        pm.parent(handChildren, None)
        transform.matchWorldTransform(handRef, ikCns)
        transform.matchWorldTransform(handRef, ikCtrl)
        # Also swap the order of the IK and IK offset. arm_R0_ikcns_ctl should be child.
        pm.parent(ikCtrl, ikCns.getParent())
        pm.parent(ikCns, ikCtrl)
        pm.parent(handChildren, ikCns)
        oRoot = rigbits.addNPO(ikCtrl)[0]
        attribute.lockAttribute(oRoot)
        attribute.lockAttribute(ikCns, attributes=['v'])
3 Likes