Home > General, Math > FITC Preview, 2-link IK

FITC Preview, 2-link IK

April 9, 2007

Following is a continuing preview of my talk, ‘Dynamic Skeletal Animation’ to be presented at FITC Toronto.

The two-link chain is both an important starting point for general IK solutions as well as an important optimization for game engines. Many game characters can be constructed entirely from hierarchies of single or compound two-link chains.

Analytic solutions are possible for 2D rigs as there is a single degree of freedom at each joint. The two methods for solving the 2-link IK problem are algebraic and geometric. Algebraic methods work from the analytic formula for the FK problem (attempting to derive the inverse function). Geometric methods are more intuitive and treat the problem as one from plane geometry.

In the Flash community, geometric methods have been discussed in books such as ‘Making Things Move’ or at this link. Actually, the code from both of these sources is nearly identical. In ‘Making Things Move,’ Keith does a good job of illustrating dual solutions to the 2-link, in-plane IK problem and showing how to alter the code to generate each solution.

Both examples use bones with identical lengths, which is rare in production rigs. When bones are of different lengths, it is necessary to take into account all possible regions of infeasible solutions. For example, take the MTM two-link example code and replace the ‘chain link’ bones with rectangles of lengths 100 and 50. The crosshairs in the following screen shot illustrate the initial coordinates of the root bone. The square illustrates the target. Notice the wild orientation of the bones.

This is a result of invalid arguments passed to an acos() function. In addition to showing how to compensate for infeasible solutions, I hope to illustrate a hybrid algebraic/geometric solution to the two-link problem (if time allows).

See you in Toronto.

Categories: General, Math
%d bloggers like this: