Graphics Programs Reference
In-Depth Information
7
Using a Camera in 3D
In the last chapter, we talked about how we could move one or more objects around in
3D space while we, as the viewer or camera, remained in one place. But we know from
film and television that it is very common to have one or more cameras move around
a scene, so we would like to be able to incorporate some camera movement into Flash.
We'll start out with some simple camera movement to get our feet wet. Then, we'll
move to the creation of a camera object and its relationship to objects in a scene. This
will lead us to consider different ways in which a user can move interactively through a
3D space, including rotating a camera. The main topics of this chapter will be
• simple camera translation
• viewer objects and scenes
• interactive navigation in 3D space
• viewer rotation
• background considerations
Exercise 7.1: Simple Camera Translation
Let's start by creating some objects around which we can move a camera. Open the
7_1_puppyCam.fla file in the Chapter 7 folder. The entire script is included as a refer-
ence on the following page to reinforce concepts we discussed previously. It has the
usual placeObj() and displayObj() functions that we have been using.
In this example, a litter of nine Poser puppies are placed in random horizontal locations,
with each one 50 pixels progressively farther away from the screen. Figure 7.1 displays
a sample screen shot from the file. Our game plan is to modify the script so that a
viewer will be able to move in and out in the z-direction as well as left and right in the
x-direction. To achieve this, we will need to add a few lines of code that contain some
camera considerations.
Search WWH ::




Custom Search