In the previous part of the Panda3D series we rigged our slug model. Today we’ll see how to use inverse kinematics, or IK for short, to give ourselves more control over how the bones move.
Open the slug.blend file in Blender.
The Inverse Kinematics Constraint
Let’s go to edit mode, left view (Ctrl + Num 3) and select the second bone from the right:
Duplicate the bone (Shift + D) and move along the Y axis. This is going to be a controller bone:
Go to the Bone tab (A) and rename the bone ‘body_IK’ (B). We now want to unparent the bone. You can use the Relations panel in the Bone tab. Just click on the X to the right of the parent’s name to unparent (C) or you can hit Alt + P and select Clear Parent. We moved the controller bone away from the bone that we duplicated, so it’s no longer connected, which you can see in the Relations panel (D):
Select the end of the controller bone and move it along the Y axis. This way we’ll make the controller bone bigger and easier to quickly identify as the controller bone:
Now go to pose mode and select the third bone from the right, so the one after the bone you duplicated:
Go to the Bone Constraints tab (A) and add an Inverse Kinematics constraint (B). Set Target to Armature (C) and Bone to our controller bone (D). The Chain Length (E) tells us how many bones to the left (so parents) should be influenced. By default it’s set to 0, which means all parents should be influenced:
If you now select and move the controller bone, you can see how the parent bones are moving along. Hit Esc to cancel the operation:
Our model is fully rigged, we have the inverse kinematics constraint in place. But we want the whole model to move along with the bones, which it doesn’t. This means the armature must exert influence on the mesh.
So, we have to apply the armature to the mesh. To do that, go to object mode and select first the mesh (A) and then the armature (B), thus making the armature the active object:
Then hit Ctrl + P to set the parent and select With Automatic Weights:
This way we assigned the particular bones to their corresponding portions of the mesh to be controlled. Now go to pose mode, select the controller bone and move it around. You will see that the mesh is moving along:
And now select some of the tentacle bones one by one and rotate them:
The mesh is moving along. When you’re done, hit A to select all the bones and then Alt + G to reset the positions of the bones, and finally then Alt + R to reset their rotations: