1 The Project• Open the Main scene • Drag Ground and Buildings prefab into Hierarchy window • Drag the Skybox material into the Scene window • Drag the VRLog prefab into the Hierarchy wi
Trang 2Laser Cop VR Training
Day
Jay Santos, Unity Technologies
Trang 3Demo
Trang 4About Me
Trang 5Assets
Trang 8https://www.assetstore.unity3d.com/en/#!/list/46441-laser-cop-assets
Trang 101) The Project
• Open the Main scene
• Drag Ground and Buildings prefab into Hierarchy window
• Drag the Skybox material into the Scene window
• Drag the VRLog prefab into the Hierarchy window
• Drag the CameraEditorControl script onto the PlayerRig game object
Trang 112) Enabling VR
• Add the PlayerTrackingAdjust script to the PlayerRig
• Add the VRObjectTracking script to the Left and Right Hands under the PlayerRig
• For each hand, set the correct VR Node type
• Enble VR by clicking VR->Enabe VR at the top or by going to Edit->Project Settings->Player->Other Settings->Virtual Reality Supported
• Drag the BodyToHeadTracking script to the PlayerBody object under the PlayerRig
Trang 123) Graphics and Pooling
• Add the Object Pool Manager script to the Object Pools game object
• Set the size of the Pools property to 4
• Add the Bullet, Impact, Explosion, and MeleeCut prefabs to the Object Pool Manager and set the size for each to 10
• Add a Post Processing Behavior component to the HMD object
• Locate the Main profile, in the Post Processing folder, and add it to the Profile property of the Post Processing Behavior on the HMD
• Feel free to play around with post processing configurations!
Trang 134) Ranged Drones
• Locate the Navigation Arc object under the Environment Object and Bake its Navmesh
• Disable the Mesh Collider on the Navigation Arc
• Drag a Ranged Drone from the Prefab folder into the Scene
• Add a NavmeshAgent Component to the Ranged Drone
• Add a RangedDrone script to the Ranged Drone
• Apply the changes to the Ranged Drone game object
Trang 145) The Player Sword
• Under each Hand game object, delete the Temporary game objects
• Drag the LaserSword prefab onto each Hand game object
• Add the Sword script to the LaserSword game object
• Add the Tip game object to the Sword Tip property of the Sword script
• Apply the changes to the LaserSword prefab to apply then to the other hand
Trang 156) Melee Drones
• Drag the MeleeDrone prefab into the Scene window
• Add the MeleeDrone script to the MeleeDrone game object
• Change the Max Target Height to 1.8
• Apply changes to MeleeDrone
• Drag the AttachableSlicer prefab onto the LaserSword game object
• Apply the changes to the LaserSword prefab
• Change the code from MeleeDrone starting from line 43 to
Trang 167) Physics Settings
• Open the Time settings (Edit->Project Settings->Time) and set the Fixed Timestep to 0125
• Open the Physics settings (Edit->Project
Settings->Physics) and set the Gravity to -1 on the Y axis
• Adjust the Collision Matrix
Trang 178) Audio
• Add SwordAudio script to the LaserSword
• Set the clip of the Audio Source to Whoosh Wav
• Apply changes to LaserSword prefab
• Add an Audio Source to the Game Manager object and assign a clip to it
• Set Play on Awake and Loop to true and Volume to 2
• Go to Audio setting (Edit->Project Settings->Audio) and set the Spacializer Plugin to the Oculus Spacializer
• Set the Spatialize property on the follow Audio Sources: Laser Sword, Ranged and Melee Drone, Bullet, Explosion, and MeleeCut
Trang 189) Spawning Many Enemies
• Delete the Ranged Drone and Melee Drone from the scene
• Add the GM_SpawnModule script to the Game Manager game object
• Drag the Enemy Wave objects onto the Waves property
• Drag the Ranged Drone prefab on the Ranged Enemy property
• Drag the Ranged Drone Spawn Points onto the Ranged Spawn Points property
• Drag the Melee Drone prefab onto the Melee Enemy property
• Drag the Melee Drone Spawn Points onto the Melee Spawn Points property
Trang 1910) Switching Hands
• Drag Controller prefabs onto each Hand game object
• Add a RaycastInput script to the Controller game object
• On the VRLineRenderer, set the Start Width to 1 and End Width to 5
• Apply the changes to the Controller prefab
• Add the GM_HandModule script to the Game Manager
• Add Swords and Controllers to the GM_HandModule component
• Set the Starting Mode to Controllers
Trang 2011) Pausing and UI Interaction
• Drag the Pause Manager prefab into the Hierarchy window
• Locate the OK Button in the Pause Manager and add a Box Collider component
• Adjust the size of the Box Collider to (500, 150, 1)
• Apply the prefab changes to the Pause Manager
Trang 2112) Player Health
• Add the GM_PostEffectModule script to the Game Manager game object
• Add the Main and Damaged post effects profile to the Default Profile and Damaged Profile properties
• Add the hurt sounds to the Sounds list
• Add Player Health script to Player Body game object (under PlayerRig)
• Add an OnDamaged event and set it to call the PlayDamageEffect method of the
GM_PostProcessModule script
• Add an OnKilled event and set it to call the Stop method of the GM_EnemySpawn module script
• Add an OnKilled event and set it to call the TogglePause method of the Pause Manager script Make sure to check the checkbox!
Trang 22Thank you!
Jay Santos Lead Evangelist – SAPAC
jay@unity3d.com