Home Forums Unity SDK Eye Tracking Data Reply To: Eye Tracking Data

#12217
Grant [Tobii]
Keymaster

Hi @johnolap and thanks for your query. You can get access to the gaze data from the eye tracker device via the GazeRay object.

The GazeRay is a Struct containing the gaze ray for left and right eye composed of: Origin – The point in world space for the origin of the gaze ray & Direction – The normalized direction vector in world space for the direction of the gaze ray.

Please find below a simple code snippet to use this object

private void Update () 
{
    var gazeRay = TobiiXR.EyeTrackingData.GazeRay;

    // Check if gaze ray is valid
    if(TobiiXR.EyeTrackingData.GazeRay.IsValid)
    {
        // Eye Origin is in World Space
        var rayOrigin = TobiiXR.EyeTrackingData.GazeRay.Origin;

        // Eye Direction is a normalized direction vector in World Space
        var rayDirection = TobiiXR.EyeTrackingData.GazeRay.Direction;
    }
}

You can find further details about this @ https://vr.tobii.com/sdk/develop/unity/documentation/api-reference/

Please do let us know if we can provide any further information. Best Wishes.