Lab Document link: Google Doc for CPP VR Lab - Feb 28, 2025 - VR Flight Simulation
- Pull Unity Project from above Github Repo Link
- Load project via Unity Hub
- Go to Assets\XRI_Examples\Scenes\XRI_Examples_Main and load the scene
- Explore the scene
- Create a duplicate of the XRI_Examples_Main scene
- Delete all unnecessary gameobjects except the XR Rig, environment, joystick and wheel
- Download and Import spaceship asset from: Hi-Rez Spaceships Creator Free Sample | 3D Space | Unity Asset Store
- Import desired spaceship model onto the duplicated scene
- Move the xr rig inside the spaceship cockpit
- Make 6 colliders around the cockpit so that xr rig doesnt fall out of spaceship during gameplay
- Move the joystick and wheel inside cockpit
- Duplicate joystick and move to right
- Create a new script and name it ‘FlightSimulatorControls’ and copy paste the code from here: VRLabFeb28_FlightSimulation/Assets/Scripts/FlightSimulationControls.cs
- Go to the 1st joystick and set the on value change fields as follows: (pic in google doc above)
- Go to 2nd joystick, change joystick motion to ‘front back’ and set the on value change fields as follows: (pic in google doc above)
- Go to wheel and set the on value change field to: (pic in google doc above)
- Thats all! Now click play and start flying away!
- Optionally you can download and import an island from: Free Island Collection | 3D Landscapes | Unity Asset Store
- Open up one of the island sample scenes, copy and paste the spaceship and environment gameobject to this island sample scene
- Adjust your gameobjects accordingly and enjoy crashing into an island!