FK/IK switch in Blender 2.49


Forward and inverse kinematics

When we run the mhx_import script, the toggle button FK/IK switch decides whether dynamical switching between Forward Kinematics (FK) and Inverse Kinematics (IK) is possible. If not, we have two more buttons to set Arm IK and Leg IK; they have no effect if the FK/IK button is active.

Let us load a character with switching enabled. We now set the amount of IK with the four sliders on the top of the panel. The upper sliders control the left and right arms, and the lower ones control the left and right legs, respectively.

When the sliders are at their default position, as shown in the figure, the rotation of the bones are controlled by the bones on layer 1 (the circles). When the sliders are at their extreme right position, the deform bones can not be moved directly. Instead, they are controlled the IK targets on layer 3 (Arm IK) and layer 5 (Leg IK). FK/IK blending can be animated by setting keys for the slider bones.

How FK/IK switching works

The character have two sets of arms and legs, the deform bones on layer 1 and an IK chain hidden on layer 19. The deform bones have Copy Rotation constraints which are driven by the X location of the slider bones. The influences of these constraints thus depend on the location of the sliders. When the sliders are at their default position to the left, the limb is controlled by the FK bones (constraint influence = 0), and when they are to the right, the limb is controlled by the IK bones (constraint influence = 1).



Update problem

Unfortunately, FK/IK switching is not updated in real time by default. When one of the slider bones is moved, FK/IK blending is only updated once you click in either an IPO editor window or an Action editor window.

The origin of this problem is that the constraint IPOs are connected to a pose action rather than to the constraints themselves (at least that is what the tooltips say). More precisely, select one of the bones with constraint, e.g LoArm_L, and open a IPO window. The circled button is active. Once it is deactivated, the constraints and FK/IK blending updates in real time. Unfortunately, I have not found a way to deactivate this button from python, so it must be done manually after the character has been imported.



To fix the problem permanently for you character, do the following

1. Select the bone LoArm_L
2. Click on the Copy Rotation constraint. The driver IPO curve appears in the IPO window. It is called "CoIpo.001".
3. The circled button is pressed. Unpress it.
4. When the button is unpressed, the IPO curve disappears. Reselect it in the popup menu to the right of the button. Make sure to reselect the correct curve (CoIpo.001), because otherwise the constraint may be driven by the wrong bone.
5. Repeat for all other driven bones, i.e. UpArm_L, LoArm_L, Hand_L, UpLeg_L, LoLeg_L, Foot_L, Toe_L and the same on the right side.

The only problem with this approach is that there are 14 different bones with driven constraints, and the procedure must be repeated for each of them. To fix this manually after import is doable, but if you only intend to use the character briefly, it may be faster to update by hand by pressing in an Ipo or Action window.