Unity XR (beta)

The Unity XR package manager is a new approach of Unity to supporting XR devices. This implementation forms the new basis for VR devices like Oculus, WIndows Mixed Reality and OpenVR.

Note: this is still in development in both Unity and Humanoid Control. Therefore features can be missing (like Oculus hand tracking and OpenVR skeletal input) and contains bugs.

Prerequisites

Pawn Control

This is still in development.

Humanoid Control

Preliminary Unity XR support is available in version 3.2 for Unity 2020.1, Unity 2019.3 is supported from version 3.2 beta 12.

Unity

Unity 2019.3 and higher are supported

Setup

For Unity XR support in Unity 2019, first make sure Legacy XR suport is disabled. Go to Edit Menu->Project Settings->Player->XR Settings and ensure Virtual Reality Supported is disabled:

Go to Edit Menu->Project Settings->XR Plugin Management and click on the Install XR Plugin Management button:

Then enable the desired XR Plugin. For example the Oculus plugin for Android:

Configuration

To enable body tracking with Unity XR for an avatar, Unity XR needs to be enabled in the Humanoid Control component:

Head Target

To use an HMD tracking for the head of the avatar Unity XR needs to be enabled on the Head Target too. This is enabled by default:

The Camera parameter is the camera which is used for the first person view. It can be cleared when no camera view is desired and only the tracking of the head is needed. For example if you want to see the avatar’s movements in third person view.

Hand Target

When you want to control the hands of the avatar using Unity XR you need to enable Unity XR on the Hand Target:

The Controller parameter is a reference to the Unity XR Controller in the Real World representing the actual controller used.

Unity XR Controller

This component is a representation of the Unity XR controller in the real world. It provides all the input information of the controller.

The Transform of the Unity XR Controller will always contain the position and rotation of the controller when it is being tracked.

StatusThe tracking status of the controller.
Unavailable: Controller is not connected
Present: Controller is available but is not currently being tracked
Tracking: Controller is being tracked
Rotation ConfidenceA quality indication of the rotation value.
0: lowest confidence
1: highest confidence
Position ConfidenceA quality indication of the position value.
0: lowest confidence
1: highest confidence
Auto UpdateTrue, the controller value are automatically updated every frame
False, you need to call the UpdateComponent() function to update the values.
TrackerThe Unity XR tracker
isLeftTrue: this is the left hand controller.
False: this is the right hand controller.
Primary AxisThe value of the primary joystick or touchpad.
The X and Y values represent the movements of the joystick or the position on the touchpad.
The Z value represents the touching and/or pressing of the joystick.
Secondary AxisThe value of the secondary joystick or touchpad (if present)
TriggerThe value of the index finger trigger.
GripThe value of the middle finger / hand trigger.
Primary ButtonThe value of the primary button
Secondary ButtonThe value of the secondary button
MenuThe value of the menu button
BatteryThe value of the battery status of the controller
ModelA reference to the GameObject representing the model of the controller.

The buttons and Z-axis for the joystick/touchpad can have the following values:
< 0: no touching, > 0 touching
-1..0: closeness to the joystick or touchpad
0..1: press value
The actual values depend on the hardware: whether a touch sensor or proximity sensor is available and/or whether the button is an on/off button or can measure the amount of pressure.