• Public
  • Public/Protected
  • All

Class WebXREyeTracking

The WebXR Eye Tracking feature grabs eye data from the device and provides it in an easy-access format. Currently only enabled for BabylonNative applications.







disableAutoAttachSearch playground for disableAutoAttach

disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposedSearch playground for isDisposed

isDisposed: boolean

Is this feature disposed?

Readonly onEyeTrackingEndedObservableSearch playground for onEyeTrackingEndedObservable

onEyeTrackingEndedObservable: Observable<void>

This observable will notify registered observers when eye tracking ends

Readonly onEyeTrackingFrameUpdateObservableSearch playground for onEyeTrackingFrameUpdateObservable

onEyeTrackingFrameUpdateObservable: Observable<Ray>

This observable will notify registered observers on each frame that has valid tracking

Readonly onEyeTrackingStartedObservableSearch playground for onEyeTrackingStartedObservable

onEyeTrackingStartedObservable: Observable<Ray>

This observable will notify registered observers when eye tracking starts

xrNativeFeatureNameSearch playground for xrNativeFeatureName

xrNativeFeatureName: string

The name of the native xr feature name (like anchor, hit-test, or hand-tracking)

Static Readonly NameSearch playground for Name

Name: string

The module's name

Static Readonly VersionSearch playground for Version

Version: number

The (Babylon) version of this module. This is an integer representing the implementation version. This number does not correspond to the WebXR specs version



  • get attached(): boolean


  • get isEyeGazeValid(): boolean
  • Returns whether the gaze data is valid or not

    Returns boolean

    true if the data is valid


attachSearch playground for attach

  • attach(force?: boolean): boolean
  • attach this feature


    • Optional force: boolean

      should attachment be forced (even when already attached)

    Returns boolean

    true if successful, false is failed or already attached

detachSearch playground for detach

  • detach(): boolean

disposeSearch playground for dispose

  • dispose(): void

getEyeGazeSearch playground for getEyeGaze

  • Get a reference to the gaze ray. This data is valid while eye tracking persists, and will be set to null when gaze data is no longer available

    Returns Nullable<Ray>

    a reference to the gaze ray if it exists and is valid, returns null otherwise.

isCompatibleSearch playground for isCompatible

  • isCompatible(): boolean
  • This function will be executed during before enabling the feature and can be used to not-allow enabling it. Note that at this point the session has NOT started, so this is purely checking if the browser supports it

    Returns boolean

    whether or not the feature is compatible in this environment


  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method