How To Create A Virtual Reality Project with Unity in less than 20 minutes! (For Oculus Developers)
I’m Kaz, and I’m going to walk you through creating a functional project in VR step by step! You can view the video below, or read the text version.
Step 1: Install the Latest Version of Unity. In this tutorial I am using 2019.4, but any recent version should be fine.
Step 2: Create a New Project (3D)
Step 3: Go to the Asset Store (Window > Asset Store) and search for Oculus Integration. Import the package.
Step 4: Go to Edit > Project Settings > XR Plugin Management. Click Install XR Plugin Management. Once that’s finished, on that same screen under Plug-In Providers check the Oculus box.
Step 5: Go to Assets > Oculus > VR > Prefabs folder and drag the OVRPlayerController onto your scene. Delete the default Main Camera in the hierarchy.
Step 6: In the hierarchy, click the dropdown next to OVRPlayerController and choose the child object OVRCameraRig. In the Inspector, scroll to Tracking Origin Type and set to Floor Level.
Step 7: In Assets > Oculus > VR > Prefabs folder, drag OVRControllerPrefab onto both the Left Hand Anchor and Right Hand Anchor (child objects of OVRPlayerController).
Step 8: Choose OVRControllerPrefab in hierarchy, in Inspector, scroll to Controller and set to L Touch for Left Hand, and R Touch for Right Hand.
Step 9: Create > 3D Object > Cube. (This will be our ground) Position under OVRPlayerController in scene.
Step 10: Create > 3D Object > Sphere. (This will be our object to interact with) Position anywhere reachable in the scene.
Step 11: Click Sphere object, in Inspector Add Component > type in OVRGrabbable
Step 12: Create > 3D Object > Cube (For the object to rest upon). Place below Sphere object in scene.
Step 13: Click OVRPlayerController, in Inspector under Character Controller, change Radius to 0.02.
Step 14: Click Sphere object, in Inspector Add Component > type “Rigidbody”.
Step 15: Click Left Hand Anchor in hierarchy, in Inspector Add Component > type “OVR Grabber”. Scroll to Controller and set to L Touch. Do same for Right Hand Anchor and set Controller to R Touch.
Step 16: Click Left Hand Anchor in hierarchy, in Inspector Add Component > type “Sphere Collider”. Set Radius to 0.05. Check box next to Is Trigger. Do the same for Right Hand Anchor
Step 17: Click Left Hand Anchor in hierarchy, in Inspector scroll to Grab Volumes under OVR Grabber, click dropdown and set Size to 1. Drag the Sphere Collider that is right below into the Element 0 slot. Right above that you see Grip Transform, drag the Left Hand Anchor from the hierarchy into that slot. Do the same for Right Hand Anchor
Step 18: Click Left Hand Anchor in hierarchy, in Inspector scroll to Rigidbody and check box next to Kinematic. Do the same for Right Hand Anchor
Step 19: Test your scene! Now that you have basic VR functionality you can create and build your unique project!