Flash Basic Theory Class 15th Chapter 3D Foundation Ⅰ

Source: Internet
Author: User

Back to "flash Basic Theory Class-Catalog"

Everything we do in the front is two-dimensional (sometimes only one-dimensional), but it can be done very cool stuff. Now, take them to the next level.

Creating 3D Graphics is always so exciting. The newly added dimension seems to have actually put objects into life. How to implement 3D in Flash is introduced in countless books and instructional software. But I'm not going to skip these things and we'll quickly finish all the basics. The motion effects discussed in the previous chapters are then placed in three-dimensional space. In more detail, we will introduce speed, acceleration, friction, bounce, screen wrapping, easing, elastic motion, coordinate rotation, and collision detection.

Now, first pay attention to the motion of the sprite movie in 3D space, using perspective to calculate the size and position of the movie on the screen. Of course, the sprite itself is flat, and we don't see its back, side, top or bottom. In the back two chapters, we'll learn the 3D modeling of the point, line, graphic and stereo graphics.

Third dimension and perspective method

The most important theory behind the 3D is another dimension beyond the existence of X and Y. This is the dimension that represents the depth, which is usually written as Z.

Flash does not have a built-in Z dimension, but it is not difficult to create it in ActionScript. In fact, it's far less complicated than the contents of our previous chapters!

Z axis

First, you need to determine which direction Z is most in: inward or outward. Recall that the third chapter discusses the coordinate system, which is opposite to the normal coordinate system in some places. The y-axis is down, not up, and the angle is clockwise, not counterclockwise.

So, when the object is far away or close to us, should we increase the position on the z axis of the object? There is no need to compare which is more correct. In fact, the subject has been discussed for a long time, and people have even given names to the two methods: the left hand system and the right hand system.

Extend your right hand, let the thumb and forefinger form an L-shaped, then bend the middle finger 90 degrees, each finger will point to a dimension. Now point your index finger at the positive half of the x-axis, and the middle finger to the positive half of the y-axis. In the right-hand coordinate system, the thumb is directed to the positive half axis of the z axis. For Flash, it means that the z axis increases as the object is far away from the observer, and the z-axis decreases as it approaches the observer, as shown in Figure 15-1.

Figure 15-1 Right-hand coordinate system

If we try with our left hand, the result is the opposite. As shown in Figure 15-2, the left-handed coordinate system.

Fig. 15-2 Left-handed coordinate system

Here we use the right-hand coordinate system as an example (Figure 15-1). There is no reason to say that you cannot use the left-handed coordinate system, except that the z axis looks better inside. The next step in creating a third dimension (z) in Flash is how to compute the simulation perspective.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.