This tutorial is about a switch between IK and FK animation. There are many different approaches. This one is probably the oldest one, but I think it still has some advantages:
– no need in making custom switch
– just one joint chain
– no scripting required
– no flips when switching between IK and FK
1. I used fairly simple hand setup, with (Fig.1):
– twist_jnt (with zero rotation limits in Y and Z axes)
– wrist_jnt (with expression: wrist_jnt.rotatex = twist_jnt.rotatex*5)
– fingers’ joints (irrelevant for this tutorial).
2. NURBS circles were used to create FK control objects for joints (I used “parent -add -shape” mel command after selecting the shape node of NURBS circle (1) and corresponding joint (2)).
3. RP IK was created from shoulder to wrist joint. IK control object was positioned at the IK handle and transforms were freezed. IK control object (master) was point-constrained to the IK handle.
4. Next I created a CV line on the elbow joint. This line has only a helper function in order to position the pole vector control object later on while animating. This line was created in a way that it lies in the same plane as the joint chain does. It is oriented towards the natural direction of the elbow benging. Moreover, if you select the RP IK handle, you can see that this helper line is also oriented same as the joint chain plane indicator of the rotation disk does.
To make this line, I simply V-snapped the 1st CV to the LRA of the elbow_jnt. The 2nd CV I positioned so that the created line lies along the LRA / equator of the joint (Fig.2).
Then I parent-constrained the line (slave) to the elbow_jnt (master).
5. NURBS sphere was created as a pole vector control object. I C-snapped it to the end of the helper line and froze the transforms. After this I selected the sphere and IK handle and set a pole vector constraint.
6. In Maya I put the “Set Preferred Angle” command from “Skeleton” menu to the shelf and pulled out the “IK/FK Keys” submenu from “Animate” menu (Fig.3).
We are ready to begin the animation.
1. I planned to make FK shoulder rotation from F1 to F20; F20-F40 should be some IK movement with elbow rotation; from F40 again FK. I also left auto-keyframe on. Honestly, I do not know if it is nesessary, sinse Maya keys all joints and IK automatically, if you use Set IK/FK Key option, but I use autokey anyway.
2. You should start by selecting IK control object and IK handle and pressing “Connect to IK/FK”. A connection will be made and you should see a result in a help line. You will also notice, that “Enable IK Solver” gets checked.
3. Because we want to start with FK, we must de-activate IK solver. While you are at F1, uncheck “Enable IK Solver” and press “Set IK/FK Key”.
4. Next I moved to F20 and rotated the shoulder_jnt. You can rotate whatever joint(s). With any joint selected, press “Set IK/FK Key”.
5. Now, still being at the frame 20, we want to switch to IK. You will notice that IK control objects were left behind. First of all, C-snap the elbow control to the end of the help line (it nicely followed the elbow joint while in FK) and V-snap the wrist IK control to the IK handle.
6. With the IK handle selected, press (1) “SPA” shelf buttom (“Set Preferred Angle” from “Skeleton” menu) and (2) “Move IK to FK” option from “IK/FK Keys”. This ensures that IK matches FK and there will be no flips. Only now check “Enable IK Solver” box and press “Set IK/FK Key”.
You are still on F20, but from now on you are ready to animate in IK.
7. On F40 we want to switch back to FK. First, “Set IK/FK Key” for your current IK control object position.
8. Uncheck “Enable IK Solver” box and press “Set IK/FK Key”.
9. Now you are in FK again. Proceed to further frames and FK animation. Always use “Set IK/FK Key” for your keyframes.
10. When you switch between IK and FK (and vice versa), the Graph Editor displays the animation curves of an IK handle and its joints partly as solid lines and partly as dotted lines. When you display an animation curve for Translate X, Y, or Z of an IK handle, the curve is displayed as a solid line when “Enable IK Solver” is on. The curve is a dotted line when “Enable IK Solver” is off. In otherwords, the solid line show where the IK handle controls the joint chains animation. The dotted line shows where FK (keyed joint rotations) controls the animation. The reverse is true for a selected joint in the handle’s joint chain. When you display an animation curve for Rotate X, Y, or Z of a joint, the curve is displayed as a solid line when “Enable IK Solver” is off. The curve is a dotted line when “Enable IK Solver” is on. In other words, the solid
line shows where FK controls the animation. The dotted line show where IK has control.