Eye Tracking – Migrating from VIVE Pro Eye to Focus 3 using Unity and OpenXR
⚠ NOTICE |
This legacy plugin is no longer being updated and maintained, please develop mobile content with OpenXR 2-in-1 Unity / Unreal package . |
What will you learn?
You will learn how to migrate your eye tracking project from VIVE Pro Eye to Focus 3 using OpenXR and Unity.
Note:
In this tutorial we will use
Unity 2021.3.9f1
and
VIVE Focus 3.
Project Settings
- In Unity, switch build target to Android.
- Install the latest version of VIVE OpenXR Plugin – Android.
- Go to Edit > Project Settings > XR Plug-in Management and enable OpenXR and VIVE Focus 3 Support feature group.
- Go to Edit > Project Settings > XR Plug-in Management > OpenXR and add the Eye Gaze Interaction profile.
- Add this line to the AndroidManifest:
<uses-feature android:name="wave.feature.eyetracking" android:required="true" />
Setup Scene
- Add the Eye Gaze (OpenXR) binding to your input actions asset.
- Create a script to utilize the data.
using UnityEngine;
using UnityEngine.InputSystem;
public class EyeGazeTest : MonoBehaviour
{
[SerializeField] private InputActionAsset actionAsset;
[SerializeField] private InputActionReference eyePose;
private void OnEnable()
{
if (actionAsset != null)
{
actionAsset.Enable();
}
}
private void Update()
{
UnityEngine.XR.OpenXR.Input.Pose pose =
eyePose.action.ReadValue<UnityEngine.XR.OpenXR.Input.Pose>();
Debug.Log($"Position: {pose.position} Rotation: {pose.rotation}");
}
}
- Add the references for the Input Action Asset and Input Action Reference.