Graphics Programs Reference
In-Depth Information
30
31
32
33
xdata = [-320,-160, 0, 160, 320,
-320,-160, 0, 160, 320,
-320,-160, 0, 160, 320 ]
Step 7: Modify the viewer position
The easiest way to move the glasses up on the Stage is to adjust the viewer position.
Moving the viewer up about 50 pixels should do the job. Also, judging from the size of
the glasses in Figure 7.25, the viewer may be a little too close, so let's move her back.
The viewer position here should work and yield the results shown in Figure 7.26.
1
2
3
//create a viewer object with position & rotation properties
viewer = {x:50, y:-50, z:-50, ry:0 }
Figure 7.26 Layout after modifying the spacing and viewer position
Step 8: Add the viewer rotation
We're finally ready to add the viewer rotation, so let's take a look at the onEnterFrame
handler. Instead of using the Left Arrow and Right Arrow keys to move the viewer hori-
zontally, we'll use them to control the angular rotation ry of the viewer about the y-axis.
 
Search WWH ::




Custom Search