Positioning objects in a 3D scene

Before we start adding objects to the scene, it is important to know how objects are positioned in a 3D environment.

Traditional 2D Flash applications place objects on the screen along the X (or horizontal) and Y (or vertical) axes. These Cartesian coordinates uniquely define a position in 2D space.

Away3D extends the 2D coordinate system by adding a third Z-axis to allow the depth of an object to be defined.

3D coordinate systems are generally referred to as left or right handed. Away3D uses a left-handed coordinate system. To visualize the left-handed coordinate system, hold your left hand up with your palm facing away from you. Point your middle finger away from you in the same direction as the palm of your hand. Point your index finger straight up in the air, and point your thumb to the right. With your fingers and thumb pointing like this imagine that your middle finger is the Z-axis, your index finger is the Y-axis, and your thumb is the X-axis, with each finger or thumb pointing towards the positive ends of the axes.

While pointing your fingers in the air might seem like an amusing exercise, it is an easy way to work out which way is up in 3D.

The following image shows the three axes that make up a left-handed 3D coordinate system. Notice that the Y-axis in the coordinate system is inverted compared to the traditional 2D coordinate system used by Flash. In Flash, placing an object lower on the screen means assigning it a higher position on the Y-axis. In Away3D, objects with higher Y values will move up along the Y-axis.

Positioning objects in a 3D scene
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.72.86