> For the complete documentation index, see [llms.txt](https://help.imotions.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.imotions.com/lab/study-setup-and-design/virtual-reality/htc-vive-pro-eye/htc-vive-1st-generation-unity-and-eye-tracking-configuration-in-imotions.md).

# Legacy HTC Vive (1st Generation): Unity and Eye tracking Configuration in iMotions

This article will walk you through on how to combine eye tracking within a virtual reality experience using the HTC Vive or HTC Vive Pro.

**Study Limitations**

To derive eye tracking data from a VR experience, the Tobii SDK must be integrated into the game itself. Currently, the SDK integration is only available in Unity. Therefore, eye-tracking VR studies are limited to **VR apps that you are able to edit in Unity.**

**Hardware & Software Requirements**

Currently, the only hardware that this integration supports is the **Tobii HTC Vive Eye Tracking Headset.**

Before we get started, please make sure you have downloaded and installed the required software packages:

1. The latest version of [iMotions](https://help.imotions.com/lab/getting-started/download-and-install-imotions.md) - With the VR eye tracking module
2. The [Tobii Core Software for VR](http://developer.tobii.com/?wpdmdl=205). This installer contains all the essential drivers for the VR eye tracker.
3. Steam and SteamVR for your current [VR setup.](https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe)
4. [Unity](https://store.unity.com/) version 2018.2.13f1 (or higher) installed. Earlier versions might be compatible, but the iMotions Unity Package was developed for version 2018.2 or above and is the only one directly supported in this documentation.
5. The [SteamVR Plugin](https://assetstore.unity.com/packages/templates/systems/steamvr-plugin-32647) by Valve Corporation from the Unity Asset Store. Install/import this asset into your project and accept all the SteamVR settings (make sure you have backed up your project before doing this).
6. Finally, download the iMotions VR Eye tracking Unity Package, If you do not already have this file, please reach out to iMotions Support.

**Importing and setting up the iMotions Unity package**

First, import the Unity package into your project by dragging-and-dropping the file into your projects assets window and accepting the import. ![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-21f3f40248d4e1884178e927b769212459b14d29%2F94fd2facde_u4ithhxokywntjjhlmdcgmceclip0.webp?alt=media) You should now see the following folders in your assets directory:

SteamVR, TobiiDemo, TobiiPackage & TobiiPro.

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-0f1e2d8506096a76ba09ac0cd3c9800b0d334ff4%2F72ae4fac96_rbr71wdbs0smchhqgmxbjgmceclip1.webp?alt=media)

Next, open the TobiiPackage folder and navigate to the Prefabs subfolder. In this folder, there are three Prefab GameObjects. Drag “CalibrationRoom” and “TobiiControl” into the Scene Hierarchy (leave the ViewPortCameraPrefab for now. It will be used later in the setup). Make sure these prefabs are not placed into any transform parent GameObjects.

If your project didn’t already have VR implemented through SteamVR then the next thing you will have to do is to import the SteamVR \[CameraRig] prefab from Assets/SteamVR/Prefabs into your Scene Hierarchy. You can also drag in the \[SteamVR] prefab from the same folder while you are at it.

SteamVR controllers can be manipulated to interact, and control the calibration and environment progress.

![vr\_input\_source.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-c871afefc9d67575551969c9a0716ec4e6e422e1%2F1564e246e0_vr_input_source.webp?alt=media)

You access this menu by going into Window -> SteamVR input.

By default, the main controllers for starting calibration and advancing into the environment, is F1(start calibration) and Space(advance into environment.

If you wanna read more about SteamVR controller input, then look here [SteamVR forum](https://steamcommunity.com/sharedfiles/filedetails/?id=1416820276)

Your hierarchy should now contain the elements shown in the excerpt below as well as your own project elements.

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-4da51f2784ab121b45dbc3c51bd6a0a36456300c%2Fbef18f64ea_elhpojpyo0wig3zav39bgmceclip3.webp?alt=media) Make sure the \[CameraRig] GameObject is placed within the CalibrationRoom (You can tell from the teal square that shows up once you have selected the “CalibrationRoom”-object, if it is not then please readjust it by manipulating the positional Z-axis in the GameObjects Transform Component.Click on the “TobiiControl” in the scene hierarchy to select it in the inspector. Check that the variables are identical to the image below.

Make sure that View Port Camera Prefab is set to ViewPortCamera. If its not, go into the Tobiipackage/prefabs and drag in the ViewPortCamera prefab. If the Camera variable is empty (do not worry, this should be set in script at runtime), but if you are not using a standard VR setup or a packaged solution like VRTK then make sure to set the correct camera in this variable. You can click on that little icon next to the empty variable field and find the camera variable (It will be the "camera" located under SteamVR camera).

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-fc9d83e1c28e9ea06ad346e20270d9cb9a6c87f9%2F28a87f9e0d_vacpkg4tuifpsodkwhamceclip4.webp?alt=media) In Tobii Control script you will also find some additional options that you can toggle (if you are in doubt about what they do, you can hover over them to see a short tooltip). To make these additional options work you have to click on a GameObject in the hierarchy and click on the drop down menu “Layers” in the inspector. Here you then click “Add Layer…”, which will open up a new window called “Tags & Layers”. In this inspector window you need to type in “DesktopMonitor”. Remember to write it exactly like what is inside the quotation marks (capitalize the “D” and “M”) or it will **not** work. You should not set any object to this layer. It will all be done in scripts at runtime. Make sure that a layer called “DesktopMonitor” is present in the layer drop down menu.

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-075aa476c1a37943d23154f9fe7dfea964072692%2Fa2a9d48181_lgmypwdlq0ecncpmvablrqmceclip5.webp?alt=media) In the Eye Tracking Data script make sure to drag in the CalibrationRoom-object parent into the “Calibration Room” variable and then drag the parent that contains your own environment into the “Test Environment”-variable.

You can also add Objects of interest, which allow you to automatically get Markers placed in your iMotions data, as soon as a Gaze X.Y.Z is hitting the object. To read more about Objects of interest look here

![Object\_of\_interest1.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-7f52e9c5ac1e7fa2591af9aaec91b99c6346aad6%2F44c3176e3a_object_of_interest1.webp?alt=media)

In later version of Unity, you should be able to locate the OpenVR\_api. Go to Window - Package manager, locate OpenVR and install the latest version, you will need to restart unity afterwards. Remember to save your project.

![openVR.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-f0e4f51db7182d5080f4325b37dc43443245452d%2F0a30ec23c9_openvr.webp?alt=media)

It’s time to configure iMotions as well. If iMotions is running on the same PC as the Unity Project, then start iMotions and go into “Global Settings” under preferences. Set the Tracker model to Tobii HTC Vive VR. Set the host address to “127.0.0.1:4050” and click OK. Otherwise, type in the IP and Port that refers to the client PC running Unity.

![The Eye tracking tab of Global Settings with Tobii HTC Vive VR selected](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-4f79b8850eddbea02d1d9928ab706a1f7e5907e0%2Flab_global-settings_eye-tracking_tobii-htc-vive-vr.png?alt=media)

You have entered Play Mode: Running a VR App

You should now start the VR app, and you should see the calibration room, inside your HMD. To start the eye tracking calibration you need to click the Trigger button on the right controller. **Or use F1 to start calibration - Space to advance into the environment after calibration success, you should start the iMotions recording, before advancing however.**

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-c60bfbb3237312317bbc33238121b7bef9c8025b%2Fd816d99cb7_ljlof0mdz06qfimyr2vqamceclip7.webp?alt=media) Remember to ask the respondent/player to keep their head still and follow the appearing red dots with their eyes only for the duration of the calibration process.

Now that you are inside the VR app, and past the calibration point, you need to go into iMotions and click “Reconnect Tracker” to make the Eye tracker attempt to connect to Unity, now that the server is running. You will not receive any data and the eye tracker will not appear connected until you have done the Eye tracking calibration. You should see the iMotions Widget for the eye tracker change to display the eyefinder box, the box will say "move right", as the eyes are consider to be on a different screen (inside the headset), This will not affect the data collection. ![move\_right.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-7a0145b4ed866d4f7800ec3b2bafb3275fbd54fc%2F8ba6201e56_move_right.webp?alt=media)

You can now start your recording.

After the calibration process is done, you can press spacekey as mentioned earlier, your player will be put into the test environment you have declared as a variable in the Eye Tracking Data script (if he doesn’t you need to make sure your Test Environment is overlapping the Calibration Room in terms of position). Depending on the eye tracking indicator settings you toggled in the “Tobii Control”-script, the player might see an eye-tracking indicator. The eye tracker can be toggled on or off by pushing down the trigger button on the left controller and holding the button for a second.

That’s it! You are now recording eye tracking data in VR with iMotions and Unity. Check your recording in iMotions to make sure that everything is working properly! If it is not, try to go through the instructions again or contact <support@imotions.com>

**Analyzing VR Gaze Data**

When you have finished collecting data, VR recordings are treated as typical video stimuli in iMotions. Therefore, you can use iMotions analysis tools for dynamic stimuli, including dynamic AOIs and Gaze Mapping.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.imotions.com/lab/study-setup-and-design/virtual-reality/htc-vive-pro-eye/htc-vive-1st-generation-unity-and-eye-tracking-configuration-in-imotions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
