Back to "flash Basic Theory Class-Catalog"
The previous chapters are all about the basics of ActionScript interactive animation, or some advanced "basics." Now let's go to another interesting technique of the road, Kinematics.
What exactly is kinematics? Some of the information I've found seems daunting, a technique based on advanced 3D animation programming. Search on the Internet, you will find that the equations involved are all over the strange symbols, which has become the biggest obstacle to our learning, it seems that the contents of the previous study is like a very basic algorithm. First of all, I would say that kinematics is not that scary. The previous chapters only describe some of the basics that we need, and we need to combine them now.
Kinematics studies the motion of an object, but does not consider the mass or force exerted on the object, which is essentially a branch of mathematics. So, it's all about speed, direction, velocity vectors, and so on. Sounds not hard, huh? While this is a very simple definition, the content contained therein is more complex, but it is enough to accomplish our goal.
When people talk about kinematics in the fields of computer science, graphics and games, they are talking about two special branches of kinematics: forward kinematics and reverse kinematics. Let's start from here.
Introduction to forward and reverse kinematics
In general, both forward and reverse kinematics systems are made up of interconnected components, such as chain chains or a string of arms connected by joints. They are responsible for the movement of the entire system and the movement of a part relative to other parts and the entire system.
Typically, a kinematic system has two ends: a fixed end (base) and a free end. An arm with a joint is usually anchored to one end, while the other is stretched out to catch something. A chain may have one or two ends attached to something, or nothing at all.
The motion in forward kinematics (Forward kinematics, abbreviation: FK) is the movement at the free end, starting with the fixed end of the system. Inverse kinematics (Inverse kinematics, abbreviated: IK) is reversed: movement begins at the free end, back to the fixed end, if any.
Usually, the lower limbs are considered to be forward kinematics when walking. The movement of the thigh leads to the movement of the calf, the movement of the calf moves the foot, and finally makes the foot produce movement. The movement of the foot does not determine the movement of the other part, it is driven by itself, and its position is determined by the position of the lower limb.
An example of a reverse kinematics is to pull someone by hand. Here, the force is used for the free end-the hand-control hand, forearm, arm, so that the whole body position and movement.
To put it more carefully, for example, a reverse kinematics is a hand that reaches out to get something, and the hand drives the system. Of course, it can also be said that the arms and forearms are also moving, they control the position of the hand. Yes, but the immediate goal is to put your hands in a certain position. This is the power of transmission. It is not a practical force, but an intention. The forearms and arms simply set the position of the hand according to the needs of the structure by arranging their position.
We will find out the difference between the two in the next chapter through concrete examples. But now, remember that dragging and stretching are general inverse kinematics, and a repetitive circular motion, such as walking, is the most common forward kinematics, the subject of this chapter.
Preparation of forward kinematics programming
Both Kinematics programming has the following basic elements:
System parts. We are called joints (Segment).
The position of the joints.
The rotation of the joints.
Each joint in the example is a rectangle, like a forearm, a large arm, or a portion of the thigh. Of course, the end of the joint can be any shape, such as hands, feet, pliers, thorns or invaders of the green laser cannon.
Each joint will have an end as a pivot, around which it can rotate. If the joint has other joints, the joints will also be rotated with their other ends as pivot. Like a large arm revolving around the shoulder, the arm rotates around the elbow and the hand rotates around the wrist.
Of course, in many real-world systems, this axis rotation can have multiple orientations. Think about how many ways we can get our hands spinning around the wrist. At the end of this book, you may try it yourself in Flash. But now, our system is completely two-dimensional.