- Home /
Getting Eyetracking data (HTC VIVE PRO EYE)
Hello,
I'm currently working on a project. In this project, I'd like to track and record the eyetracking data (the user's gaze movements) in VR using VIVE Eye Pro. I have no clue even on where to start.
Could anyone tell me anything about that please? I know that Tobii (the eyetracker built in HTC VIVE PRO) provides an anlytical software that can do what I want to do but at the cost of more than 8000 dollars.. So, this option is not for me.
Thanks!
Answer by AskCarol · Dec 10, 2019 at 08:13 PM
Have you taken a look at VIVE SRanipal SDK?
You can find instruction on how to install it here: https://forum.unity.com/threads/vive-pro-eye-unity-retina-tracking-examples.707000/#post-4725098
Answer by Tech-Labs · Jul 14, 2020 at 01:55 PM
@zeonyw Did you manage to put something together? I would be interested in how you solved this. I've found a method for calculating the gaze position (on screen/camera). So if you're still looking for the answer, just let me know.
@Tech-Labs Could you clarify which method you found to calculate the gaze position ? I'm still interested. Thanks.
@Aline_Farias I would echo @AskCarol 's advice.. Did you check out VIVE SRanipal SDK? That is what I use as well.
@Tech-Labs Could you clarify which method you found to calculate the gaze position ? I'm still interested. Thanks.
@Aline_Farias Hi. Sure. These are a few lines of code I scraped together from different sources and which work for me. Note that I use TobiiXR 2.0.0.174 and not the latest (2.1.1.177). The latest version has made non-compatible changes in the code which I haven't tried solving yet. I also use the VIVE Eye and Facial Tracking SDK 1.3.3.0 and Unity 2020.3.x and the latest XR Plugin Management Unity tool and OpenXR plugin.
using Tobii.XR;
using Tobii;
using ViveSR.anipal.Eye;
using ViveSR.anipal;
//Inside Update()
TobiiXR_EyeTrackingData eyeTrackingData = EyeTrackingDataHelper.Clone(provider.EyeTrackingDataLocal);
Matrix4x4 localToWorldMatrix = provider.LocalToWorldMatrix;
EyeTrackingDataHelper.TransformGazeData(eyeTrackingData, localToWorldMatrix);
TobiiXR_GazeRay gazeRay = eyeTrackingData.GazeRay;
if (Physics.Raycast(gazeRay.Origin, gazeRay.Direction, out hitray))
{
distance = hitray.distance;
}
interpolatedGazeDirection = Vector3.Lerp(_lastGazeDirection, gazeRay.Direction, _smoothMoveSpeed * Time.unscaledDeltaTime); //Get the direction
usedDirection = _smoothMove ? interpolatedGazeDirection.normalized : gazeRay.Direction.normalized; //Get the direction
transform.position = gazeRay.Origin + usedDirection * distance; //Set the position of the gaze dot image
I hope this helps. It is obviously just a copy-paste section of my code.
Your answer
![](https://koobas.hobune.stream/wayback/20220612215433im_/https://answers.unity.com/themes/thub/images/avi.jpg)