• Public
  • Public/Protected
  • All

Exposes the WebXR Layers API.





disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposed: boolean

Is this feature disposed?

xrNativeFeatureName: string

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

Name: "xr-layers" = "xr-layers"

The module's name

Version: 1 = 1

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
  • Is this feature attached

    Returns boolean


  • addXRSessionLayer(wrappedLayer: WebXRLayerWrapper): void
  • Add a new layer to the already-existing list of layers


    • wrappedLayer: WebXRLayerWrapper

      the new layer to add to the existing ones

    Returns void

  • attach(): boolean
  • Attach this feature. Will usually be called by the features manager.

    Returns boolean

    true if successful.

  • Creates a new XRProjectionLayer.


    • Optional params: XRProjectionLayerInit

      an object providing configuration options for the new XRProjectionLayer.

    • Optional multiview: boolean

      whether the projection layer should render with multiview.

    Returns WebXRProjectionLayerWrapper

    the projection layer

  • Creates a new XRWebGLLayer.


    • Optional params: XRWebGLLayerInit

      an object providing configuration options for the new XRWebGLLayer

    Returns WebXRWebGLLayerWrapper

    the XRWebGLLayer

  • detach(): boolean
  • detach this feature.

    Returns boolean

    true if successful, false if failed or already detached

  • dispose(): void
  • Dispose this feature and all of the resources attached.

    Returns void

  • 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

  • setXRSessionLayers(wrappedLayers: WebXRLayerWrapper[]): void
  • Sets the layers to be used by the XR session. Note that you must call this function with any layers you wish to render to since it adds them to the XR session's render state (replacing any layers that were added in a previous call to setXRSessionLayers or updateRenderState). This method also sets up the session manager's render target texture provider as the first layer in the array, which feeds the WebXR camera(s) attached to the session.


    • wrappedLayers: WebXRLayerWrapper[]

      An array of WebXRLayerWrapper, usually returned from the WebXRLayers createLayer functions.

    Returns void


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