gamecamp! and game dev @ davis introduction to unity®
TRANSCRIPT
GameCamp! andGame Dev @ DavisIntroduction to Unity®
Launch Unity®
Create New 3D Project
Unity® Interface
Empty SceneDelete main camera and directional light in the Hierarchy View so that there is nothing in the object hierarchy.
Create Terrain▼Game Object
►Create► 3D Object
►Terrain
Center the Terrain▼Terrain Inspector
►Transform►Positionx = -1000
y = 0z = -1000
Navigate to TerrainUsing the navigation tools, navigate to find the terrain in Scene View
Add a LightAdd directional light▼Hierarchy
►Create ► Light
►Directional Light
Make the Terrain PrettyImport terrain assets▼Assets
►Right Click - Import Package►Environment
►Import All
Make the Terrain PrettyClick on terrain In the inspector click the
paintbrush in the middle▼Edit Textures
►Add TextureChoose any textureSet X & Y size = 1
Create Character ControllerImport character controller assets▼Assets
►Import package►Characters
►Import allIn your project view, drag a first person controller from Assets/Standard Assets/Character/FPS Character/Prefabs/FPSController to the Scene View (shown on next slide)
Character Controller
TestRun the game to see what happens
Add Features to TerrainAdd topology▼Terrain Inspector
►Raise/Lower Terrain button (Leftmost button)►Choose any brush
Draw on terrain to make mountains►Smooth height button (3rd from left)
►Choose any brushDraw on terrain to smooth mountains
Move Character ControllerMove Character Controller above terrain▼Select First Person Controller (either in Hierarchy or
Scene view)►Press “W” to allow object to be translated
►Drag yellow/green arrow upwards in Scene View to make sure First Person Controller is above the terrain.
TestRun the game to see what happens
Create a Tree PrefabIn Project View, go to Assets/Standard Assets/Environment/Speed Tree/Palm and drag “Palm_Desktop” into the hierarchy
Create a Tree PrefabAdd a capsule collider to palm tree▼Palm Tree Inspector
►Add Component►Physics
►Capsule Collider
Create a Tree PrefabModify capsule collider▼Palm Tree Inspector
►Capsule Collider►Center
X = 0, Z = 0►Radius
0.4
Create a Tree PrefabRename your palm to “Palm 2”
Drag Palm 2 from the Hierarchy View to the Project View’s main directory (“Assets”)
Palm Tree
Add Features to TerrainUse the Tree tool in the Terrain’s terrain component
▼Trees button (3rd from right)►Edit trees
►Add Tree►Tree
►Choose “Palm 2”►Add
►Mass Place Trees►Place
Trees!
TestRun the game to see what happens
Prepare External Script Editor
Unity® Menu/File Menu -> Preference -> External Tools -> External Script Editor:
Make sure it is set to MonoDevelop
Rocket LauncherCreate a new script for Controller (RocketLauncher) and add as component to FPSController
Replace the void update function call with:
http://pastebin.com/nWYwxJiS
Finished Scene
Play!Hit the “Play” button● WASD to move● Right Click to “load” rocket launcher”● Left Click to fire
Gameplay
Extra● Switch values in the FPSController● Make changes to the terrain and the
terrain/tree colliders