Search form

'Building Interactive Worlds in 3D': The Donut Tutorial — Part 3

VFXWorld presents a new excerpt from Building Interactive Worlds in 3D by Jean-Marc Gauthier. This month's excerpt is a tutorial on creating an interactive path.

All images from Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier. Reprinted with permission.

This is the latest in a series of excerpts from Building Interactive Worlds in 3D by Jean-Marc Gauthier.

Creating an Interactive Path

Please note that the Follow Path behavior can be found in the Virtual Sets, Resource Folder > Behavior Scripts, located on the right of the screen. You can access this behavior, and many other behaviors created in this book, from the companion CD-ROM. Open Virtools, go to the top menu, select Resources > Open Data Resource and select the file virtual sets.rsc on the CD-ROM. On the right side of the Virtools interface, select Behavior Graphs > Interactive Paths > Follow Path. This behavior was created earlier in section 2.1 of this chapter. You can refer to this section for more details about how to design this behavior. Although we decided to apply the behavior to a camera in this example, you can follow the same steps with other 3D objects or interactive characters. Go to Level Manager > Global > Camera and drag and drop the Follow Path behavior on the word "camera." The script is added under the camera named Path Camera in this example. Double click on the script's name to open the Schematic window with the Follow Path script. Edit the Position on Curve with the name of the curve used as a path. When testing the scene, you will notice that the camera follows the continuous curve without interruption. You may want to change the position and orientation of the camera on the curve. Stop the playback, and go to Initial Conditions. Select and move the camera to a new position. Select Initial Conditions for the camera, and hit Play. The camera follows the curve with a new position and orientation. You can edit the direction of the camera by selecting the reference axis of the object following the curve. For example, if the camera moves forward along a Z axis, it will move backward when you select the -Z axis.

Controlling the Camera's Speed on the Path

The viewer can control the speed of the camera. Please note that the Follow Path & Change Speed behavior can be found in the Virtual Sets, Resource Folder > Behavior Scripts, located on the right of the screen. Please note that this behavior was created earlier in section 2.3 of this chapter. You can refer to this section for more details about how to design this behavior. Open Virtools, go to the top menu, select Resources > Open Data Resource and select the file virtual sets.rsc on the CD-ROM. On the right side of the Virtools interface, select Behavior Graphs > Interactive Paths > Change Speed. Go to Level Manager > Global > Camera, and drag and drop the Follow Path & Change Speed behavior on the word "camera." The script is added under the camera named in this example Path Camera. Double click on the script's name to open the Schematic window with the Follow Path script. Edit the Position on Curve with the name of the curve used as a path. After setting up the Follow Path & Change Speed behavior scene, you will notice that you can accelerate and decelerate the camera by pressing the arrow keys on your keyboard.

The Follow Path behavior can be found in the Virtual Sets, Resource Folder > Behavior Scripts, located on the right side of the screen.

Switching between Path Camera and Free Camera

The viewer can use the keyboard to turn a path camera into a free-range camera. We can add a new interactive behavior to the camera by switching between the camera scripts. Please note that the Free Camera script and the Switching Script script can be found in the Virtual Sets, Resource Folder > Behavior Scripts, located on the right of the screen. Please note that these behaviors were created earlier in section 2.4 of this chapter. You can refer to this section for more details about how to design this behavior. Go to Level Manager > Global > Camera, and drag and drop the Free Camera script and the Switching Script script on the word "camera." The scripts are added under the camera named Path Camera. Double click on the script's name to open the Schematic window with the Switching Script script. In the top line, edit the names of the Follow Path Camera and the Free Camera inside the Activate and Deactivate building blocks. After setting up the Switching Script script and the Free Camera script, you will notice that you can press the space bar on your keyboard to turn your path camera into a free camera and vice versa.

Find more turnkey tutorials that detail all the steps required to build simulations and interactions in by Jean-Marc Gauthier: Focal Press, 2005. 422 pages with illustrations. ISBN 0-240-80622-0 ($49.95). Check back to VFXWorld frequently to read new excerpts.

Jean-Marc Gauthier teaches at New York University in the graduate studies department of Interactive Telecommunications and is the author of Interactive 3D Actors and Their Worlds (Morgan Kaufmann Publishers 2000). He is also a consultant at www.tinkering.net and an award-winning 3D artist.