(Flash) Inverse kinematics with two segments - Math and (Quasi) physics in AS3

| No Comments | No TrackBacks

The angles of a triangle(OAB) can be computed if the length of three sides are known using transformed version of cosine formula. Note that the angle between line L and OB is also needed to obtain actual angles of the segments.

Low of cosines

OAB = 
Math.acos((OA * OA + AB * AB - BO * BO) /
(2 * OA * AB));

BOA =
Math.acos((OA * OA + BO * BO - AB * AB) /
(2 * OA * BO));

ABO =
Math.acos((AB * AB + BO * BO - OA * OA) /
(2 * BO* AB));

See 'Law of cosines - Wikipedia' for more about cosine formura.

sample movie and scripts

No TrackBacks

TrackBack URL: http://www.kynd.info/cp-bin/mt/mt-tb.cgi/41

Leave a comment