Game Development Reference
In-Depth Information
6.5 Teleportation
Teleportation is a player mechanic often used to move the player's character
very quickly to different locations in a map. It can happen explicitly via
actual teleportation devices placed in a game environment, such as they
are in Quake , which make it obvious that the player's location has changed
or inexplicitly by which teleportation is the developer's trick for loading
another game level or another part of a map. Inexplicit teleportation can
occur when very large game environments need to be divided up into
workable chunks the computer's processor can handle. If you play the
original Halo you will experience this transition. When the player reaches
the physical boundary of a game mesh, a shimmer falls over the screen and
the next part of the map is loaded. The same type of teleportation can occur
when a character reaches the exterior door of a building and the game
needs to load the inside map of the building so the player can enter
it and continue playing.
Both types of teleportation are examined in the next workshop.
6.5.1 Implicit Teleports
Hands On
Teleportation
Step 1. Download Chapter Six/teleport.zip from the Web site.
Open the project in which you will find two scenes inside a folder
called _Scenes , one called outside and the other sewerScene . The
one with the sewer model is an original project downloaded from
the Unity Web site. The other is a simple terrain. Open the outside
scene.
Step 2. Play. You will have control over a first person character and be
able to move around on a terrain in which there is a large factory and
a door with a light above it.
Step 3. Add a cube game object to the scene. Transform, rotate, and
scale the cube until it sits neatly in front of the factory door, as shown
in Figure 6.16 .
Step 4. Select the cube in the Hierarchy, and in the Inspector turn off
the Mesh Renderer and check the IsTrigger for its box collider. This will
make the cube invisible and leave just the collider as a trigger.
Step 5. Create a new tag called toSewer and set this as the tag for the
cube.
Step 6. Create a new JavaScript file named teleport, add the script in
Listing 6.19 , and attach it to the First Person Controller.
Search Nedrilad ::




Custom Search