Creating a CCD solver
In this section, you will learn about and implement the CCD IK algorithm. CCD stands for Cyclic Coordinate Descent. This algorithm can be used to pose a chain of joints in a way that the last joint on the chain comes as close as possible to touching a target. You will be able to use CCD to create limb and other IK systems where a chain needs to be solved using a target point.
There are three important concepts for CCD. First, there is the goal, the point in space you are trying to touch. Next is the IK chain, which is a list of all of the joints that will need to rotate to reach the goal. Finally, there is the end effector, which is the last joint in the chain (the one that needs to touch the goal).
With a goal, chain, and end effector, the CCD algorithm in pseudocode looks like this:
// Loop through all joints in the chain in reverse, // starting with the joint before the end effecor foreach joint in ikchain.reverse() { Â Â Â Â // Find...