Game Development Reference
In-Depth Information
Unity Triggers
Thus far we have looked at causing commands to be fired on user-driven
events (such as mouse over, mouse down, etc.). We've looked at firing
commands at the game's opening. In this chapter we will begin looking at
firing commands based upon where the player is in the level. We'll do this via
triggers .
Specifically we will look at using this sort of mechanism to provide screen
hints via GUIText. Additionally, this will allow for a new way to move from this
EntryWay level to the Hallway level. Triggers can be used to trip any event
though. Booby traps could be sprung, lighting changed, objects created or
destroyed, all through a trigger.
The First Person Controller has a collider around it that's actually part of
the Character Controller script. Remember that colliders are Unity's way
of keeping track of when objects bump into each other or penetrate each
other (referred to as collision detection ). When we imported the EntryWay
level from Maya, we activated the Generate Colliders option in the FBX
Import section. This ensured that we didn't fall through the floor—the
collider of the level and the collider on the First Person Controller kept this
from happening.
Search WWH ::




Custom Search