Game Development Reference
In-Depth Information
Components
Now that you've had a chance to experiment with the First Person Controller's basic functionality,
it's time to inspect the First Person Controller itself.
1.
Select the First Person Controller in the Hierarchy view.
2.
Click its down arrow to expand its hierarchy (Figure 3-6 ).
Figure 3-6. The expanded First Person Controller
You will find it has two children, Graphics and Main Camera.
3.
Select Graphics.
It has only two components besides the requisite Transform component. The Mesh Filter holds an
internal mesh that you do not have access to, though for all intents and purposes, it is a capsule. In
the Mesh Renderer component, it is worth noting that Cast Shadows and Receive Shadows are both
turned off. Shadow calculation is expensive, and this object is more of a visual placeholder, so you
neither want to waste resources nor have it cast shadows into the scene.
4.
Select Main Camera.
Besides the components you have already seen on the original scene camera, this has a Mouse
Look script. If you are starting to catch on to the components idea, you may have wondered if one
couldn't just add a Camera component to the First Person Controller directly. Let's try it and see
what happens.
5.
First, deactivate the Main Camera gameObject by unchecking the check box
next to its name at the top of the Inspector.
With no camera in the scene, the Game view goes blank.
6.
Select the First Person Controller.
7.
From the Component menu, Rendering, add Camera.
The Game view is once again rendered.
8.
Click Play, and drive around the scene.
 
Search WWH ::




Custom Search