Post on 24-Jan-2017
transcript
By Shahed ChowdhuriSenior Technical Evangelist
Unity 5: First Person TutorialFirst-person controls, terrain & environment
@shahedC
WakeUpAndCode.com
AgendaInitial Setup, Asset Store
> First-Person Controls> Terrain, Trees, Colliders> Textures, Grass & Rocks, Water
Wrap-Up
Assign Code Editor
Click Edit PreferencesUnder External Tools, select your Script Editore.g. MonoDevelop or Visual Studio
Tip: Browse for devenv.exe in your Program Files folder if you don’t see Visual Studio"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe"
VS Code Setup on Windows
http://darkgenesis.zenithmoon.com/configuring-unity3d-to-use-the-new-lightweight-visual-studio-code-editor/
1. Click Edit Preferences
2. External Tools
3. Browse to:• “C:\Users\<profile>\AppData\Local\Code\Bin\”
4. Select code.cmd
OPTIONAL:In VS Code, open the project folder to use Intellisense
VS Code Setup on Mac
http://unreferencedinstance.com/how-to-integrate-visual-studio-code-with-unity3d-project/
1. Click Assets Sync MonoDevelop Project
2. Open VS Code, pick project folder
3. Pick a project (-csharp.sln) file
Choose Theme: Light, Dark, High Contrast
On the top menu,1.Click View2.Click Theme3.Choose a theme:
• Light Theme• Dark Theme• High Contrast Theme
AgendaInitial Setup, Asset Store
> First-Person Controls> Terrain, Trees, Colliders> Textures, Grass & Rocks, Water
Wrap-Up
Create New 3D Project
… choose 3D, then click “Create project”
Name your project…
Click File New Project…
Locate FPS Controller in Project Panel In the Project Panel,
Open the following:• Standard Assets
• Characters• FirstPersonCharacter
• Prefabs• FPSController
FirstPersonController Script
Locate FirstPersonController script under:/Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/
Update Scale for Tree PrefabIn the Project panel,
click the Prefabfor the tree you selected,
e.g. Banyan
Enter a larger Scale Factor
e.g. 1
Click Apply to update all trees!
Drag Tree Prefab to Scene
From Project panel, drag any tree prefab to the Scene
Path: /Assets/Terrain Assets/Trees Ambient-Occlusion/
Add Capsule Collider
With the tree selected in the Hierarchy, click Add Component Physics Capsule Collider in the Inspector panel
Mass Place New Tree with Collider
1. Click “Place Trees” tool in Inspector with Terrain selected in Hierarchy2. Click Edit Trees… to Add Tree (prefab with collider)3. Mass Place Trees!
3 2
1
Add Texture to Terrain
1. Click “Paint Texture” tool2. Click Edit Textures…3. Click Add Texture…
1
2 3
Add Another Texture with Normal Map
1. Click Select button2. Choose another Texture, e.g. Mud Rocky Albedo and Mud Rocky Normal3. Click Add
1
2
3
Add a Grassy Texture
1. Click Select button2. Choose another Texture, e.g. Grassy Hill Albedo3. Click Add
1
2
3
Choose Grass Texture
1. Click icon next to Detail Texture2. Choose a Grass Texture, e.g. Grass Hill Albedo3. Click Add
1
23
Choose Rock Texture
1. Click icon next to Detail Texture2. Choose a Rock Texture, e.g. Rock Mesh3. Update color and change Render Mode (Vertex Lit)4. Click Add
1 2
4
3
Need a Rock with Collider?1. Drag
RockMesh into Scene.
2. Rename it in Hierachy.
3. Create empty Prefab, and drag rock into it.
1
2
3
Add Capsule Collider
With the rock selected in the Hierarchy, click Add Component Physics Capsule Collider in the Inspector panel
AgendaInitial Setup, Asset Store
> First-Person Controls> Terrain, Trees, Colliders> Textures, Grass & Rocks, Water
Wrap-Up
From OneDrive: http://1drv.ms/1TUMufE Extract into Assets folder…
Download Models Zip File
Drag Prefab into Hierarchy
Drag “bazooka” prefab into “FirstPersonCharacter”(just below FPSController)
For More Info:• Unity Indie Devs:
• http://facebook.com/groups/UnityIndieDevs • http://WakeUpAndCode.com/unity
• Xbox One Indie Devs:• http://facebook.com/groups/XboxOneIndieDevs• http://WakeUpAndCode.com/xb1
Contact
Email: shchowd@microsoft.com Twitter: @shahedC