Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To start with inverse kinematics reaching, you'll take this chapter's initial example, OneSegment.as, and add to that. That file simply had the segment rotating to a target, which was the mouse position.
First, you need to determine where the segment should be to exactly touch that target. This is the same calculation you use to position the segment when you're dragging. However, in this case, you don't actually move the segment. You just find that position. So, what do you do with that position? You use that as the target of the next segment up the line, and have that segment rotate to that position. When you reach the base of the system, you then work back down, positioning each piece on the end of its parent. Figure 14-4 illustrates how this works.