~~~~ creating the project + importing oculus VR ~~~~
- create a new 3D 2019.1.8f1 project
- switch platform to android, texture compression = ASTC
- import integration 1.38 from the archives (https://developer.oculus.com/downloads/package/unity-integration-archive/1.38.0/)
- select yes & restart when asked to update OVRplugin and spatializer.
- you must add an App ID in order to use hands/controllers!
create an app on the oculus dashboard
copy paste ID into oculus > avatars AND platform? > edit settings
~~~~ configuring project settings ~~~~
- project settings > player > XR settings > check VR supported. then add oculus to SDK list
- change company name and product name, then go to other settings > change package name
- remove vulkan from graphics APIs
- minimum API level = lollipop (21)
- change quality settings for best performance. i combined oculus’ standard quest setup with recommendations i found online – see screenshot!
~~~~ adding VR functionality ~~~~
- delete the main camera in your sample scene. we won’t be needing this anymore
- drag OVRPlayerController prefab into scene. now we can move (character controller component) & look around in VR (OVRCameraRig)!
- on the OVR Manager component:
target device = quest
tracking origin type = floor level
uncheck Allow Recenter if your game features locomotion (rather than a stationary position, such as a cockpit) - for hands, drag CustomHandLeft/Right into the scene.
most tutorials ask you to place it under the left/right hand anchors, but when i tried that – at least for this version of oculus integration – my hands ended up looking like this:
i’ve also heard that in general, parenting the hands directly to the camera rig creates lots of jitter and lag? it seems like the best thing to do is make them their own separate game objects, and then…
- on each hand’s OVR Grabber script:
drag TrackingSpace (!!) into each hand’s Parent Transform. (not OVRCameraRig, not OVRPlayerController.) - for even more optimization, you can check “parent held object.” this parents any object you’re holding directly to your hand, which eliminates the jitter caused by fixedupdate – BUT can mess up some intricate physics.
(in my case, we’re not stacking blocks or anything – we’re just gonna be holding a camera and a journal. but later on when i add climbing, i might have to turn that off.)
~~~~ setting up your environment ~~~~
- create or import your room environment
- to make an object grabbable: add the OVR Grabbable component to it (+ a collider if there isn’t one already)
~~~~ some tweaks ~~~~
- right now, bringing a grabbable close to your head dramatically pushes you around. we can fix this :)
- head to layers > make a “Player” layer and a “Grabbable” layer
- in player settings > physics, disable the collision between the 2.
- assign “Player” to OVRPlayerController (only on the top level, not recursively) and “Grabbable” to all grabbable objects
Leave a Reply