|
| 1 | +# Getting started with Eye Tracking in MRTK |
| 2 | +This page covers how to set up your Unity MRTK scene to use Eye Tracking in your app. |
| 3 | +The following assumes you are starting out with a fresh new scene. |
| 4 | +Alternatively, you can check out our already configured Eye Tracking examples: |
| 5 | +[MRTK Eye Tracking Examples](EyeTracking_ExamplesOverview.md). |
| 6 | + |
| 7 | + |
| 8 | +### Setting up the scene |
| 9 | +Set up the _MixedRealityToolkit_ by simply clicking _'Mixed Reality Toolkit -> Configure…'_ in the menu bar. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +### Setting up the MRTK profiles required for Eye Tracking |
| 15 | +After setting up your MRTK scene, you will be asked to choose a profile for MRTK. |
| 16 | +You can simply select _DefaultMixedRealityToolkitConfigurationProfile_ and then select the _'Copy & Customize'_ option. |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +### Create an "Eye Gaze Data Provider" |
| 22 | +- Navigate to the _'Input System Profile'_ in your MRTK main profile. |
| 23 | + |
| 24 | +- To edit the default one ( _'DefaultMixedRealityInputSystemProfile'_ ), click the _'Clone'_ button next to it. |
| 25 | + |
| 26 | +- Double click on your new input profile and select _'+ Add Data Provider'_. |
| 27 | + |
| 28 | +- Create a new data provider: |
| 29 | + - Under **Type** select _'Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input'_ -> _'WindowsMixedRealityEyeGazeDataProvider'_ |
| 30 | + |
| 31 | + - For **Platform(s)** select _'Windows Universal'_. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +### Enabling Eye Tracking in the GazeProvider |
| 37 | +In HoloLens v1, head gaze was used as primary pointing technique. |
| 38 | +While head gaze is still available via the _GazeProvider_ in MRTK which is attached to your [Camera](https://docs.unity3d.com/ScriptReference/Camera.html), you can check to use eye gaze instead by ticking the _'Prefer Eye Tracking'_ checkbox as shown in the screenshot below. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +### Simulating Eye Tracking in the Unity Editor |
| 44 | +You can simulate Eye Tracking input in the Unity Editor to ensure that events are correctly triggered before deploying the app to your HoloLens 2. |
| 45 | +The eye gaze signal is simulated by simply using the camera's location as eye gaze origin and the camera's forward vector as eye gaze direction. |
| 46 | +While this is great for initial testing, please note that it is not a good imitation for rapid eye movements. |
| 47 | +For this, it is better to ensure frequent tests of your eye-based interactions on the HoloLens 2. |
| 48 | + |
| 49 | +1. **Enable simulated Eye Tracking**: |
| 50 | + - Navigate to your main _'MRTK Configuration Profile'_ -> _'Input System Profile'_ -> _'Data Providers'_ -> _'Input Simulation Service'_. |
| 51 | + - Check the _'Simulate Eye Position'_ checkbox. |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +2. **Disable default head gaze cursor**: |
| 56 | +In general, we recommend to avoid showing an eye gaze cursor or if you insist on showing one to make it _very_ subtle. |
| 57 | +Check out our [eye gaze cursor tutorial](EyeTracking_Cursor.md) for more information on how to best handle it. |
| 58 | +We do recommend to hide the default head gaze cursor that is attached to the MRTK gaze pointer profile by default. |
| 59 | + - Navigate to your main _'MRTK Configuration Profile'_ -> _'Input System Profile'_ -> _'PointerSettings.PointerProfile'_ |
| 60 | + - At the bottom of the _'PointerProfile'_, you should assign an invisible cursor prefab to the _'GazeCursor'_. If you downloaded the MRTK Examples folder, you can simply reference the included -'EyeGazeCursor'_ prefab. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +### Accessing eye gaze data |
| 65 | +Now that your scene is set up to use Eye Tracking, let's take a look at how to access it in your scripts: |
| 66 | +[Accessing Eye Tracking Data in your Unity Script](EyeTracking_EyeGazeProvider.md). |
| 67 | + |
| 68 | + |
| 69 | +### Testing your Unity app on a HoloLens 2 |
| 70 | +Building your app with Eye Tracking should be similar to how you would compile other HoloLens 2 MRTK apps. |
| 71 | +The only difference is that the *'Gaze Input'* capability is unfortunately not yet supported by Unity under 'Player Settings -> Publishing Settings -> Capabilities'. |
| 72 | +To use Eye Tracking on your HoloLens 2 device, you need to manually edit the package manifest that is part of your build Visual Studio project. |
| 73 | +So, follow these steps: |
| 74 | +1. Build your Unity project as you would normally do for _HoloLens 2_. |
| 75 | +2. Open your compiled Visual Studio project and then open the _'Package.appxmanifest'_ in your solution. |
| 76 | +3. Make sure to tick the _'Gaze Input'_ checkbox under _Capabilities_. |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +--- |
| 81 | +[Back to "Eye Tracking in the MixedRealityToolkit"](EyeTracking_Main.md) |
0 commit comments