Tutorial
Heading
Dec 29, 2023

Unity Oculus XR with hand-tracking setup

This tutorial is focused on explaining the step-by-step process of setting up a new Unity project with XR features using Oculus software

Premise

Powered by the Unity Engine, Oculus XR provides creators with an extensive toolkit to craft immersive XR experiences and push the boundaries of digital reality.

Mission

This tutorial is focused on explaining the step-by-step process of setting up a new Unity project with XR features using Oculus software, emphasizing the utilization of hand-tracking functionality over traditional controllers.

Resources

  • Unity packages:
    - Oculus XR plugin (com.unity.xr.oculus)
    - OpenXR plugin (com.unity.xr.openxr)
    - XR Core utilities (com.unity.xr.core-utils)
    - XR Interaction toolkit (com.unity.xr.interaction.toolkit)
    - XR Legacy Input helpers (com.unity.xr.legacyinputhelpers)
    - XR plugin Management (com.unity.xr.management)
    - XR Hands (com.unity.xr.hands)

Physical Resources

  • Oculus Device. (Oculus 3 was used to make this documentation).

Development

Software installation and set up

Create or open a Unity project with a version higher than 2021.3.26f1. If you are creating a new project, is recommended to use the 3D (URP) template for optimized, best-in-class graphics in XR.

Navigate to the Package Manager or Asset Store and install all the Unity packages/assets previously listed.

Out of Unity, download and install:

Open Oculus Developer Hub, log in or create a new account, and select the ADB path of the Unity version you are using (the path should be something like this C:\Program Files\Unity\Hub\Editor\2022.3.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\adb.exe)

Open Oculus software, log in or create a new account, and follow the steps to connect your device.

Air link connection is recommended over cable for Unity testing.

For debugging, if you are connected by Air link, when starting Play mode in Unity, the app will execute on the Oculus device.

For installing the built APK, connect by Cable link and add it to the Apps section in Meta Quest Developer Hub’s Device Manager.

Unity project XR set up

Go to Project Settings/XR Plug-in Management and enable Oculus in all tabs.

Unity editor - Project Settings/XR Plug-in Management

Inside XR Plug-in Management, go to OpenXR. In the Android tab, under OpenXR Feature Groups, enable Hand Tracking Subsystem, Meta Hand Tracking Aim and Meta XR Foveation.

Unity editor - Project Settings/OpenXR

In Oculus section, click in “Fix All” if you have any outstanding issues.

Unity editor - Project Settings/Oculus

Now in the Unity top bar, click in “Oculus/Tools/Create store-compatible AndroidManifest.xml.” Remember to update “AndroidManifest.xml” if you change app permissions.

Unity editor - Oculus/Tools

Open File/Build Settings, select the "Android platform" and click on “Switch Platform”.

Unity editor - Build Settings

XR functionality

Once Meta XR Interaction SDK OVR Samples is installed, search for “OculusInteractionSampleRig.prefab” in the project “Packages/Meta XR Interaction SDK OVR Samples/Runtime/Prefabs” and add it to the scene.

Go to the OVRCameraRig, and in OVR Manager, enable the target device you are using. Select “Controllers And Hands” for Hand Tracking Support and “V2” for Hand Tracking Version in Quest Features/General.

It is also recommended to select “Floor Level” in Tracking Origin Type, and setting the Y position of the OculusInteractionSampleRig to 0.

Unity editor - OVRCameraRig/OVR Manager

Now, if you are connected with the Oculus device via Air link and click in “Play”, your scene will be playable on the device with hand tracking enabled. From here on, it is a matter of adding the desired functionalities.

Conclusion

In conclusion, we've successfully covered the process of setting up a Unity project with XR capabilities using Oculus software, with a focus on hand-tracking functionality. By following the steps outlined in this tutorial, you now have the tools and knowledge to embark on your own XR projects and explore the exciting possibilities of immersive experiences.

Android
Unity
XR
Code
Development
Sara Correas
Programmer

I code, therefore I am

Tutorial
Turning a 2D image into 3D using Blender
Tutorial
Trim textures: a new hope
Tutorial
Tomb Chaser 1 - Showcase