The usual way of animating is called "forward kinematics", or FK. FK is a top-down approach: to position the hand the upper arm is rotated, then the lower arm. Many movements can be achieved this way, but others are difficult: to keep the hand in place as the skeleton stands up, the arm bones need to be adjusted continuously. It takes many keys to keep the hand in place.
A better solution for this situation is "inverse kinematics", or IK. IK is a bottom-up approach: the hand position is set, then Spine automatically sets the rotation for the upper and lower arm bones.
IK is useful for many other tasks, such as keeping feet from penetrating the floor during a walk animation, adjusting the IK target at runtime to stand on uneven terrain, chickens, and more. In Spine, bones can be controlled by either FK, IK, or a mix of both. It is also possible to transition smoothly between FK and IK during an animation.
Please note that IK constraints are not available in Spine Essential.
To use IK, three bones are needed: the parent, child and target bone. The child must be a descendant of the parent, but doesn't need to be a direct descendant. The target must not be a descendant of the parent.
To begin using IK:
- Select the parent and child bones.
- In the properties box (below the tree), choose
- Then choose an existing bone to be the IK target, or click in empty space to create a new bone to be the target.
The IK constraint continually adjusts the rotation on the parent and child bones so that the tip of the child bone is at the target bone.
The direction the parent and child bones bend can be changed on the IK constraint.
When a bone's rotation is being controlled by an IK constraint the bone appears hollow, indicating that some manual transforms are not possible (see how to disable the IK constraint below).
The mix slider on the IK constraint controls how much the bone is affected by the constraint. When the mix is 0 only FK is used and when 100 only IK is used. A mix between 0 and 100 results in both FK and IK affecting the bone at the same time. Lines are drawn to show where the bones are in the FK and IK poses.
Often mixing FK and IK is only necessary to transition to and from 0 and 100 during an animation (see Keying below). However, some situations make use of mixing the FK and IK poses to achieve motion that would otherwise be difficult to key. For example, arms waving up/down slightly via IK while also performing another animation via FK. In this case it can be useful to modify the FK pose by clicking the eye dot to disable the IK constraint.
When the constraint is disabled the bones are shown at the FK pose and can be transformed as normal. Note that attachments for constrained bones cannot be edited while the constraint is disabled.
Changing the bend direction or mix in animate mode causes the key icon next to the constraint to turn orange. Clicking the key icon sets a key for the bend direction and mix, which are always keyed together.
Keying the mix is often useful to enable and disable IK during animations. The Graph can be used to apply a curve to IK keys so the speed of the mix transition can be customized.
Due to the many interactions of two bone IK with bone transforms, a few minor limitations apply:
- If the IK mix is greater than zero and the parent IK bone has nonuniform local scale (meaning the X and Y scale have different values), then the child IK bone's local Y will snap to 0. Inheriting nonuniform scale does not trigger this snapping.
- Adjusting the local shear of the parent IK bone is not allowed. Inheriting shear or shearing the child bone works as normal.