The URP (Universal Render Pipeline) is still a work in progress as of writing this page. Unless you need high control on render pipeline RIGHT NOW, just stick to the 3D project template.
1. Asset Store -> “Oculus Integration” Download and install this package. This package is what “Google VR SDK for Unity” used to be for Cardboard, before Google shut down that project and moved it to “CardboardSDK” and sort of left it to become a zombie. OK, Google rant aside, the above install will give you some very useful prefabbed components that you can use right away. Like Camera rigged with headset tracking, quest 2 hand controller APIs, some example scenes.
2. Edit -> Project Settings -> XR Plugin Management -> Install XR Plugin Management
Once the above install is done, click the Android icon tab and choose the “Oculus” for enabling the Oculus SDK for Android Quest 2, as shown above.
3. File -> Build Settings
Select Android since Quest 2 is based on Android. Also make sure “Texture Compression” is set to ASTC. This helps with some optimizations in the build and render pipeline.
Then click “Switch Platform”. (be careful to not click multiple times, or the application might hang for a while. The UI is bit weird.. right after you click "Switch Platform", that button becomes "Build" button and if you click multiple times, you will effectively be trying to Build while the editor is still compiling scripts for switching platform
).
4. Assets > Oculus > VR > Prefabs
Drag OVRPlayerController
into the Hierarchy.
5. Delete the “Main Camera” as OVRPlayerController handles all the player interaction as well as the OVRCameraRig which represents the actual headset camera
6. Select OVRCameraRig
and in Inspector, goto Tracking
. Here, set the “Tracking Origin Type” to Floor Level
. The default is Eye Level which is the setting for when you are seated. When you are standing, origin is at the Floor level.
For more details regarding this mysterious setting, I lifted off some booty straight from the horse’s mouth:
Rift Floor-Level Tracking
OVR Manager now includes Tracking Origin Type, which defaults to Eye Level (i.e., tracking origin is handled as in previous releases). When set to Floor Level, tracking origin will be calculated relative to the user’s standing height as specified during Rift setup or with the Oculus app.
Note: Floor-level tracking will often be used with standing experiences, but there may be situations in which eye-level tracking is a better fit for a standing experience, or floor-level tracking is a better fit for a seated experience.
Any application running Unity should now be able to pull the correct height information.
The point being, during the setup of Oculus Quest 2 headset, we do the height calibration where you wear the headset and stand and the Oculus sensor calibrates the height. So we can leave the origin to be floor level and the correct height setting is managed from within the headset. If your app is to be used while standing, set “Tracking Origin Type” to Floor Level. If otherwise, leave it at Eye Level.
7. Assets > Oculus > VR > Prefabs
OVRControllerPrefab
models the hands. Expand the OVRCameraRig->TrackingSpace. The drag and drop OVRControllerPrefab on LeftHandAnchor and again drag and drop OVRControllerPrefab on RightHandAnchor.
Then Select OVRControllerPrefab under RightHandAnchor (in Hierarchy). In the Inspector, under “OVR Controller Helper (Script)”, set “R Touch” in Controller
.
Then Select OVRControllerPrefab under LeftHandAnchor (in Hierarchy). In the Inspector, under “OVR Controller Helper (Script)”, set “L Touch” in Controller
.
That’s it. The setup is complete.
No Comments
You can leave the first : )