home *** CD-ROM | disk | FTP | other *** search
/ Knowledge Land / KNOWLEDGELA.ISO / pc / support / mac / ace / lib / old / start.ace
Encoding:
Text File  |  1996-04-22  |  5.2 KB  |  138 lines

  1.  
  2. //-----------------------------------------------------------------------------
  3. //
  4. //                 A Prototype for Navigation mixing 3D actors and
  5. //    a high-quality 2D-rendered background of a 3D environment.
  6. //
  7. //  By Fernando Echeverria.
  8. //
  9. //
  10. //       The goal of this prototype is to show how, in principle, we can achieve
  11. //   user-controlled navigation of 3D characters in a pseudo-3D environment,
  12. //   composed of a few 2D backgrounds, rendered from different points of view
  13. //   in a virtual 3D environment.
  14. //
  15. //   The central idea is taking advantage of the highly efficient 3D processing
  16. //   and rendering of Zoomscapes, for easy positioning of 3D characters in a
  17. //   3D coordinate system, while displaying a static background representing
  18. //   the virtual world from a particular point of view (pseudo camera).
  19. //
  20. //-----------------------------------------------------------------------------
  21.  
  22.  
  23.  
  24. Refer to walker.ace.    // for the definition of Walker
  25.  
  26. Set the window title to "A Random Walk in Jurassic Park".
  27.  
  28.  
  29. // Create the screen early, since it needs to be referred to in the room below
  30. Make a screen named mainScr.
  31.  
  32. //
  33. // Room
  34. //
  35. In system,
  36.         Make a room named r. In it,
  37.                 Make wallHeight. Set it to 70.
  38.                 Make wallPoints. Set it to
  39.                         {-300,0, -100,460, -230,800, -1300,2000, -700,4000,
  40.                          -100,4000, -150,2400, 900,800, 1000,460, 1000,0, -300,0}.
  41.  
  42.                 // Scale dimensions to allow dinos to have a size that is similar
  43.                 // to their (fixed) bump radius (100 cm).
  44.  
  45.                 For each xyNumber 'p' in wallPoints,
  46.                         p /= 6.
  47.                 WallHeight /=6 .
  48.  
  49.                 // Build the invisible constraint walls
  50.                 For each number 'k' from 1 to the number of items in wallPoints -1,
  51.                         Make p2. Set it to wallPoints's item #(k+1).
  52.                         Set p2 to p2's x,p2's y,wallHeight.
  53.                         In r,
  54.                                 Make a transparent wall from wallPoints's item #k to p2.
  55.  
  56.                 // Make a first dino walker.
  57.                 Make dinoPos. Set it to 300,400,0.
  58.                 DinoPos /= 6.
  59.                 Make diplo. Set it to a walker of {data\diplo.mov, data\diplo2.mov}
  60.                         at dinoPos facing west in r sized 100,60 in mainScr.
  61.                 diplo's speed /= 4.
  62.  
  63.                 // Make a second one.
  64.                 Set dinoPos to 100,1200,0.
  65.                 DinoPos /= 6.
  66.                 Make trex. Set it to a walker of {data\trex.mov, data\trex2.mov}
  67.                         at dinoPos facing east in r sized 80,60 in mainScr.
  68.                 trex's speed /= 4.
  69.  
  70.                 // Keep a link to the currently active walker.
  71.                 Make dino. Set it to a link to diplo.
  72.  
  73.  
  74. //
  75. // Screen
  76. //
  77. Display mainScr. In it,
  78.         // This is the 2D background, rendered from a 3D environment.
  79.         Make a picture of data\shot2.cmp at 320,240.
  80.  
  81.         // Position the camera appropriately to match background and room.
  82.         Make camPos. Set it to 370,-75,253. CamPos /= 6.
  83.         Make a camera named cam at camPos facing (-12 degs east of north) in r.
  84.  
  85.         // Make a monitor to cover the whole screen. And make it "transparent".
  86.         // This is the crucial step that allows the 3D objects to appear in front
  87.         // of the 2D background.
  88.         Make a monitor of cam from 0,0 to 640,480.
  89.         Record that it is transparent.          // this is crucial!!
  90.  
  91.  
  92.         // Use the arrow keys to control motion of currently active walker.
  93.         // Keep key pressed to continue motion in the given direction, and release
  94.         // it to stop.
  95.  
  96.         When keyed by the up-arrow key,
  97.                 Begin walking r's dino's target forward.
  98.  
  99.         When keyed by the down-arrow key,
  100.                 Begin walking r's dino's target backward.
  101.  
  102.         When keyed by the left-arrow key,
  103.                 Begin rotating r's dino's target left.
  104.  
  105.         When keyed by the right-arrow key,
  106.                 Begin rotating r's dino's target right.
  107.  
  108.         When unkeyed by the up-arrow key,
  109.                 Stop moving r's dino's target.
  110.         When unkeyed by the down-arrow key,
  111.                 Stop moving r's dino's target.
  112.         When unkeyed by the left-arrow key,
  113.                 Stop moving r's dino's target.
  114.         When unkeyed by the right-arrow key,
  115.                 Stop moving r's dino's target.
  116.  
  117.         // Toggle invisible walls to visible and back
  118.         //
  119.         When keyed by the F2 key,
  120.                 For each wall 'w' in r,
  121.                         Set w's covering's color to transparent.
  122.  
  123.         When keyed by the F3 key,
  124.                 For each wall 'w' in r,
  125.                         Set w's covering's color to blue.
  126.  
  127.         //
  128.         // Alternate active walker
  129.         //
  130.         When keyed by the tab key,
  131.                 If r's dino's target = r's diplo,
  132.                         Set r's dino to a link to r's trex.
  133.                 Otherwise,
  134.                         Set r's dino to a link to r's diplo.
  135.  
  136. // $Log: start.ace $
  137. // Revision 1.1  1996/04/22 21:36:38  Quoc
  138.