Hand tracking

Hand tracking with Varjo headsets works with Ultraleap Tracking plugin.

Note: Ultraleap Gemini software should not be installed.

Using hand tracking with Ultraleap Tracking plugin

Get Ultraleap Tracking plugin from here.

Follow the Ultraleap documentation to enable and use the plugin in your project.

When you start to develop with hand tracking, make sure to define an offset for the hand position. This is necessary because the head tracking point for your headset differs from the hand tracking point for Ultraleap.

The offsets can be defined in the Leap XR Service Provider component under Advanced Options. Select Manual Head Offset as the Device Offset Mode and set the correct values for Device Offset Y Axis, Device Offset Z Axis and Device Tilt X Axis.

Use the following offset for Varjo XR-4:

    Y:       0
    Z:       0
    X tilt:  0

Use the following offset for Varjo XR-3 and VR-3:

    Y:      -0.0112
    Z:       0.0999
    X tilt:  0

Set hand tracking offsets automatically

Attach the following component next to the Leap XR Service Provider component to handle the offsets automatically depending on the device used.

    using UnityEngine;
    using UnityEngine.XR;
    using Leap.Unity;

    [RequireComponent(typeof(LeapXRServiceProvider))]
    public class VarjoHandTrackingOffset : MonoBehaviour
    {
    private InputDevice hmd;
    private LeapXRServiceProvider xrServiceProvider;

    void Start()
    {
            hmd = InputDevices.GetDeviceAtXRNode(XRNode.Head);
            xrServiceProvider = GetComponent<LeapXRServiceProvider>();

            switch (hmd.name)
            {
            case "XR-4":
                    xrServiceProvider.deviceOffsetMode = LeapXRServiceProvider.DeviceOffsetMode.ManualHeadOffset;
                    xrServiceProvider.deviceOffsetYAxis = 0f;
                    xrServiceProvider.deviceOffsetZAxis = 0f;
                    xrServiceProvider.deviceTiltXAxis = 0f;
                    break;
            case "XR-3":
            case "VR-3":
                    xrServiceProvider.deviceOffsetMode = LeapXRServiceProvider.DeviceOffsetMode.ManualHeadOffset;
                    xrServiceProvider.deviceOffsetYAxis = -0.0112f;
                    xrServiceProvider.deviceOffsetZAxis = 0.0999f;
                    xrServiceProvider.deviceTiltXAxis = 0f;
                    break;
            }
    }
    }