Game Development Reference
In-Depth Information
3.
Click Play, and try driving to make sure the gnome can't drive up onto the
raised beds.
4.
Deselect the First Person Controller in the Hierarchy view, refocus to the
Game view, and move the mouse to watch the bazooka arm control.
5.
Stop Play mode.
6.
Rename the First Person Controller to Gnomatic Garden Defender .
7.
Drag the new combo character onto the GardenGnome prefab in the Prefab's
Characters folder.
8.
Agree to the “Possible unwanted replacement” warning, and rename the
prefab Gnomatic Garden Defender .
The character's controls are more in keeping with the environment. There is, however, one obvious
problem. The camera should follow the character as a third person so you will be able to see where
to aim once the weaponry has been activated. Fortunately, there is a script in the Standard Assets
that will work for you.
1.
Select the original Main Camera.
2.
From the Component menu, Camera-Control, select Smooth Follow.
3.
Drag the Gnomatic Garden Defender in as its Target.
4.
Set the Distance to 2.8 and the Height to 1.8 .
5.
Click Play and test.
6.
Stop Play mode.
7.
Click Play again, and carefully move the mouse straight up until you can click
out of the Game view.
8.
Select the Main Camera.
9.
From the GameObject menu, select Align View to Selected.
10.
Stop Play mode.
11.
With the Main Camera selected, in the GameObject menu, choose Align With
View.
The camera now starts fairly close to its starting position and orientation when it calculates the
Gnomatic Garden Defender's location.
Occlusion Culling
Now that you have a couple of distinct areas in your scene and a means to traverse them, you can
consider some occlusion culling. The areas cannot be seen from one to the other except when the
character is going through the gates. Unity Pro includes Umbra's Occlusion Culling system, rewritten
for Unity 4.3. If you don't have Pro, you can script your own culling when your environment has
logical culling areas.
 
Search WWH ::




Custom Search