This article has been superseded by a New Inverse Kinemaics Article
In many cases, it will be impossible for the linked structure to touch the target. For example,
you cannot touch your elbow with your hand and you cannot reach the top of a tall tree from the
ground. In some cases, the system I am about to describe may become unstable, especially if the
target moves far out of range of the structure.
If there are two solutions, this technique will find which ever is closest to the current state
of the structure.
When there are more than two joints, there will frequently be infinitely many solutions to the
problem. However, some solutions will be better than others. If your structure represents an
arm for example, some solutions will look more comfortable and others very strained. There
is often an optimal solution.
Enough, onwards.
If the End Point is on the target, then you don't want the structure to move any more, but if the End Point is very far from the target, then you want the structure to move there quickly. Again, I decided that the torque should also be proportional to the magnitude of the force vector.
One thing the previous two paragraphs do not tell you is which direction the joint needs to move. So the joint should move in a positive direction of the force points along r, and in a negative direction of the force points in the opposite direction to r.
So, put these three things together, and you get:
So then you move onto the next joint up the structure. Re-calculate the vectors a,b
and f, and calculate the torque for joint 2. Calculate the torque for all the joints in
the whole structure, then add the torque to each joint to it's angle. The End Point of the
structure should now be closer to the target. Repeat the process continuously, and it should do
it's best to keep touching the target.
To reach the target, joint 2 needs to rotate 90 degrees (see right diagram).
And to conclude, vector b is different for joints whose axis of rotation is parallel to the bone.