@@ -28,6 +28,7 @@ private void Awake()
2828
2929 Plugin . Config . EnableEyeTracking . SettingChanged += OnEyeTrackingSettingChanged ;
3030
31+ // TODO: Remove once tested with real hardware
3132 debugCube = Instantiate ( AssetCollection . Cube ) . transform ;
3233 debugCube . GetComponent < MeshRenderer > ( ) . material . color = Color . blue ;
3334 debugCube . GetComponent < Collider > ( ) . enabled = false ;
@@ -46,18 +47,28 @@ private void OnDestroy()
4647
4748 private void OnEyeGazePosition ( InputAction . CallbackContext ctx )
4849 {
50+ gazePosition = ctx . ReadValue < Vector3 > ( ) ;
51+
52+ // Sometimes the OpenXR runtime misfires and triggers eye tracking callbacks even when it doesn't support it
53+ // In that case the data is always 0, so we can just discard the event if we didn't already have data before
54+ if ( ! supported && gazePosition == Vector3 . zero )
55+ return ;
56+
4957 supported = true ;
5058 lastHardwareInput = Time . realtimeSinceStartup ;
51-
52- gazePosition = ctx . ReadValue < Vector3 > ( ) ;
5359 }
5460
5561 private void OnEyeGazeRotation ( InputAction . CallbackContext ctx )
5662 {
63+ gazeRotation = ctx . ReadValue < Quaternion > ( ) ;
64+
65+ // Sometimes the OpenXR runtime misfires and triggers eye tracking callbacks even when it doesn't support it
66+ // In that case the data is always 0, so we can just discard the event if we didn't already have data before
67+ if ( ! supported && gazeRotation == Quaternion . identity )
68+ return ;
69+
5770 supported = true ;
5871 lastHardwareInput = Time . realtimeSinceStartup ;
59-
60- gazeRotation = ctx . ReadValue < Quaternion > ( ) ;
6172 }
6273
6374 private static void OnEyeTrackingSettingChanged ( object sender , EventArgs e )
0 commit comments