home *** CD-ROM | disk | FTP | other *** search
-
- //-----------------------------------------------------------------------------
- //
- // A Prototype for Navigation mixing 3D actors and
- // a high-quality 2D-rendered background of a 3D environment.
- //
- // By Fernando Echeverria.
- //
- //
- // The goal of this prototype is to show how, in principle, we can achieve
- // user-controlled navigation of 3D characters in a pseudo-3D environment,
- // composed of a few 2D backgrounds, rendered from different points of view
- // in a virtual 3D environment.
- //
- // The central idea is taking advantage of the highly efficient 3D processing
- // and rendering of Zoomscapes, for easy positioning of 3D characters in a
- // 3D coordinate system, while displaying a static background representing
- // the virtual world from a particular point of view (pseudo camera).
- //
- //-----------------------------------------------------------------------------
-
-
-
- Refer to walker.ace. // for the definition of Walker
-
- Set the window title to "A Random Walk in Jurassic Park".
-
-
- // Create the screen early, since it needs to be referred to in the room below
- Make a screen named mainScr.
-
- //
- // Room
- //
- In system,
- Make a room named r. In it,
- Make wallHeight. Set it to 70.
- Make wallPoints. Set it to
- {-300,0, -100,460, -230,800, -1300,2000, -700,4000,
- -100,4000, -150,2400, 900,800, 1000,460, 1000,0, -300,0}.
-
- // Scale dimensions to allow dinos to have a size that is similar
- // to their (fixed) bump radius (100 cm).
-
- For each xyNumber 'p' in wallPoints,
- p /= 6.
- WallHeight /=6 .
-
- // Build the invisible constraint walls
- For each number 'k' from 1 to the number of items in wallPoints -1,
- Make p2. Set it to wallPoints's item #(k+1).
- Set p2 to p2's x,p2's y,wallHeight.
- In r,
- Make a transparent wall from wallPoints's item #k to p2.
-
- // Make a first dino walker.
- Make dinoPos. Set it to 300,400,0.
- DinoPos /= 6.
- Make diplo. Set it to a walker of {data\diplo.mov, data\diplo2.mov}
- at dinoPos facing west in r sized 100,60 in mainScr.
- diplo's speed /= 4.
-
- // Make a second one.
- Set dinoPos to 100,1200,0.
- DinoPos /= 6.
- Make trex. Set it to a walker of {data\trex.mov, data\trex2.mov}
- at dinoPos facing east in r sized 80,60 in mainScr.
- trex's speed /= 4.
-
- // Keep a link to the currently active walker.
- Make dino. Set it to a link to diplo.
-
-
- //
- // Screen
- //
- Display mainScr. In it,
- // This is the 2D background, rendered from a 3D environment.
- Make a picture of data\shot2.cmp at 320,240.
-
- // Position the camera appropriately to match background and room.
- Make camPos. Set it to 370,-75,253. CamPos /= 6.
- Make a camera named cam at camPos facing (-12 degs east of north) in r.
-
- // Make a monitor to cover the whole screen. And make it "transparent".
- // This is the crucial step that allows the 3D objects to appear in front
- // of the 2D background.
- Make a monitor of cam from 0,0 to 640,480.
- Record that it is transparent. // this is crucial!!
-
-
- // Use the arrow keys to control motion of currently active walker.
- // Keep key pressed to continue motion in the given direction, and release
- // it to stop.
-
- When keyed by the up-arrow key,
- Begin walking r's dino's target forward.
-
- When keyed by the down-arrow key,
- Begin walking r's dino's target backward.
-
- When keyed by the left-arrow key,
- Begin rotating r's dino's target left.
-
- When keyed by the right-arrow key,
- Begin rotating r's dino's target right.
-
- When unkeyed by the up-arrow key,
- Stop moving r's dino's target.
- When unkeyed by the down-arrow key,
- Stop moving r's dino's target.
- When unkeyed by the left-arrow key,
- Stop moving r's dino's target.
- When unkeyed by the right-arrow key,
- Stop moving r's dino's target.
-
- // Toggle invisible walls to visible and back
- //
- When keyed by the F2 key,
- For each wall 'w' in r,
- Set w's covering's color to transparent.
-
- When keyed by the F3 key,
- For each wall 'w' in r,
- Set w's covering's color to blue.
-
- //
- // Alternate active walker
- //
- When keyed by the tab key,
- If r's dino's target = r's diplo,
- Set r's dino to a link to r's trex.
- Otherwise,
- Set r's dino to a link to r's diplo.
-
- // $Log: start.ace $
- // Revision 1.1 1996/04/22 21:36:38 Quoc