Search code examples
c#unity-game-enginehololensmrtkwindows-mixed-reality

Is it possible to access eye tracking data like pupil diameter on hololens 2?


Is there a way to store and view eye tracking data like the size of the users pupils or the eye motion speed?

I am currently building a hololens 2 application in unity using MRTK. Now I would like to "record", store and view eye tracking data of the user.


Solution

  • I don't believe you can get pupil diameter but it looks like you could estimate angular speed by measuring the change in gaze direction between frames:

    Vector3 previousGazeDir;
    
    // ...
    
    Vector3 newGazeDir = CoreServices.InputSystem.EyeGazeProvider.GazeDirection;
    
    if (previousGazeDir != Vector3.zero)
    {
        float gazeAngle = Vector3.Angle(previousGazeDir, newGazeDir);
    
        float gazeAngularVelocity = gazeAngle/Time.deltaTime;
    
        // .. do stuff with gazeAngularVelocity
    }
    
    previousGazeDir = newGazeDir;
    

    Depending on your exact use case you may want to account for changes in the direction the head is facing.