// you’re reading...

ActionScript 3.0

Forward Kinematics in AS3

A Confession

Kinematics in action
I must confess, firstly, that a week ago I didn’t know what forward kinematics were. Everyone seems to be talking about inverse kinematics lately (”ragdoll” physics), with no love at all for her sister forward kinematics. And really, if such a thing may be said, forward kinematics is the hot sister- I’d take her over inverse anyday.

Here’s the difference: Sometimes its desirable to model movement based on a system of interconnected objects. Your body would be such a system (your hip bone’s connected to your thigh bone, your leg bone’s connected to your calf bone, your calf bone’s connected to your foot bone, etcetera). Inverse kinematics deals with all of this starting from your foot and working inward. This would be ideal for, say, modeling you falling down the stairs or off a building- provided that you were unconscious. The motion that your foot produces during the fall is determines the angle and position of your calf, which then determines those things for your thigh.

Now forward kinematics, on the other hand, goes the other way. The reason you were unconscious in the above example is because any movement started from your body (i.e. flailing in panic as you fell off the building) would be forward kinematics- it starts from your body and moves to the end of the system. Forward kinematics is used to model more mundane things like walking. The thigh is rotated, which determines the position of the calf. The calf is rotated, which in turn determines the position of the foot. Thus, the position of the foot is determined by motion originating at the body, not the reverse.

An Example of Forward Kinematics

Okay, so that’s what forward kinematics is. And here is what it looks like (click the image to see).

AS3 Forward Kinematics

See? He really walks!

A Sponsored Link

(can’t say I wasn’t honest…)

I feel that I should also confess that I got the germ of this little engine from this book:

Foundation Actionscript 3.0 Animation: Making Things Move!

It’s by some guy named Keith Peters who apparently knows his way around the VM2. It’s not a ton of classes- two in his version, three in mine. So if you’ve got $25 and about an hour, give it a shot. And if you buy it from the link above, I get two dollars or something.

Discussion

No comments for “Forward Kinematics in AS3”

Post a comment

Twitterpated