Both CCD and FABRIK solvers produce good results, but neither produces predictable results. In this section, you will learn what constraints are, where the IK solver constraints can be applied, and how to apply constraints. This will let you build much more realistic IK solvers.
Consider an IK chain that is supposed to represent a leg. You would want to make sure that the motion of each joint is predictable, for example, the knee should probably not bend forward.
This is where constraints are useful. The knee joint is a hinge; if a hinge constraint is applied, the leg IK chain will look more realistic. Using constraints, you can set rules for each joint in an IK chain.
The following steps will show you where to apply constraints in both the CCD and FABRIK solvers:
- Constraints can be applied to both CCD and FABRIK solvers, and they must be applied after each iteration. For CCD, this means inserting a bit of code here: