Game Development Reference
In-Depth Information
1.
Stop Play mode.
2.
Select the Cube object, and set its Y Scale to 5 .
3.
Disable its Hz_Position Cycler component by unchecking the box next to the
component's name.
4.
Click Play, and try to drive into the side of the Cube.
5.
The collider stops it.
6.
Disable the Cube's Box Collider.
7.
Try driving into the side of the Cube again.
With no collider, the First Person Controller goes right through the Cube. Next you will test the Is
Trigger parameter.
1.
Enable the Cube's Box Collider.
2.
Turn on the collider component's Is Trigger parameter.
3.
Drive into the side of the Cube again.
This time the Collider is on, but it no longer blocks the First Person Controller. It does, however,
register the intersection, as you will find when you start scripting.
There's one other thing you can discover about colliders as long as you are in the terrain
environment.
1.
Drive the First Person Controller around the terrain, and drive at a few of the
Palm trees.
2.
Repeat the experiment with a BigTree.
The First Person Controller goes right through both types of trees. With a small-trunked tree,
you might decide that stopping the First Person Controller would interfere with the game flow. With
something as substantial as the BigTree, being able to drive through is not something that
can be ignored.
To remedy the problem, you will start by examining the original prefab.
3.
With the Project view currently in Single Column Layout, type BigTree in the
search field at the top of the panel.
4.
To quickly identify the correct asset, you can select the Prefab filter from
“Search by Type,” the first icon to the right of the search field.
You can also slide the thumbnail slider at the bottom of the view to the far right to see the asset
icons. At the far left, you can recognize prefabs by their blue cube icons.
5.
Once the BigTree prefab is selected, take a look at its components in the
Inspector.
6.
Collapse the Tree component so you can see the components more easily
(Figure 3-13 ).
 
Search WWH ::




Custom Search