Home Forums Unity SDK Extract Eye Tracking data from Vive Pro Eye (TobiiXR SDK) Reply To: Extract Eye Tracking data from Vive Pro Eye (TobiiXR SDK)

#19261
Grant [Tobii]
Keymaster

Hi @tesirealterm, thanks for your query. I am afraid that the ‘raw’ data is not exposed within the XR SDK, however the gaze location and direction are fully available.

We discuss the means to obtain the direction vector of the gaze ray (and origin) @ https://vr.tobii.com/sdk/develop/unity/documentation/api-reference/core/

TobiiXR.GetEyeTrackingData(TobiiXR_TrackingSpace)

Where we include the sample code:

private void Update ()
{
    // Get eye tracking data in world space
    var eyeTrackingData = TobiiXR.GetEyeTrackingData(TobiiXR_TrackingSpace.World);

    // Check if gaze ray is valid
    if(eyeTrackingData.GazeRay.IsValid)
    {
        // The origin of the gaze ray is a 3D point
        var rayOrigin = eyeTrackingData.GazeRay.Origin;

        // The direction of the gaze ray is a normalized direction vector
        var rayDirection = eyeTrackingData.GazeRay.Direction;
    }

    // For social use cases, data in local space may be easier to work with
    var eyeTrackingDataLocal = TobiiXR.GetEyeTrackingData(TobiiXR_TrackingSpace.Local);

    // The EyeBlinking bool is true when the eye is closed
    var isLeftEyeBlinking = eyeTrackingDataLocal.IsLeftEyeBlinking;
    var isRightEyeBlinking = eyeTrackingDataLocal.IsRightEyeBlinking;

    // Using gaze direction in local space makes it easier to apply a local rotation
    // to your virtual eye balls.
    var eyesDirection = eyeTrackingDataLocal.GazeRay.Direction;
}

Hopefully this should be what you are looking for, please let us know how you get on.

If you are completely new to programming with Unity, it may be worth first trying out getting started guide @
https://vr.tobii.com/sdk/develop/unity/getting-started/vive-pro-eye/