Game Development Reference
the square of the equations in the solution. Whenever a square is used
the root has two solutions, one positive, the other negative. Each solution
is valid and leads to one or other of the solutions in the figure. The effect
of this in a double link chain is fairly minimal, but can still lead to a
disturbing snapping when the software analysis trips from one solution to
the other. You could attempt to minimize the rotation change and take the
minimum solution, and this can help. A fully general solution using
analysis that is robust in all circumstances can prove elusive even with a
double link chain. Adding a single additional link doubles the possible
solutions, a three-link chain having four possible valid solutions.
A four-link chain has eight solutions. A hips, torso, shoulder, bicep,
forearm, hand chain with six links will have 32 possible solutions. The
software is very likely to snap between solutions and this will lead to poor
quality animations. We need a way out of this dilemma.
Using an iterative technique to determine orientations
for a multiple link IK chain
The way we will study here was first presented by Chris Welman in his
masters thesis on IK as an extension to work developed by Li-Chun
Tommy Wang and Chih Cheng Chen in an IEEE paper 'Transactions on
Robotics and Automation'. The technique is called Cyclic Coordinate
Descent. The principal algorithm is as follows:
1 Set a loop counter to zero.
2 Start with the last link in the chain.
3 Rotate this link to point towards the target.
4 Move down the chain and repeat step 2.
5 When the base object is reached, determine if the target has been
reached or a loop limit has been reached. If so exit, if not increment
loop counter and repeat from step 2.
This algorithm has the benefit of simplicity and can be easily
To derive the angle
, we go back to the familiar methods of using
vectors. Remember that the dot product of vectors is given by
a • b = a b cos(
) where a =
( a • x 2 + a • y 2 ) and b =
( b • x 2 + b • y 2 )
Therefore, the angle
is given by
= acos( a • b / a b )