• Public
  • Public/Protected
  • All

WebXR Feature for WebXR Depth Sensing Module







disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposed: boolean

Is this feature disposed?

onGetDepthInMetersAvailable: Observable<GetDepthInMetersType>

Event that notify when DepthInformation.getDepthInMeters is available. getDepthInMeters method needs active XRFrame (not available for cached XRFrame)

xrNativeFeatureName: string

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

Name: "xr-depth-sensing" = "xr-depth-sensing"

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

  • Describes which depth sensing data format ("ushort" or "float") is used.

    Returns WebXRDepthDataFormat

  • Describes which depth-sensing usage ("cpu" or "gpu") is used.

    Returns WebXRDepthUsage

  • Height of depth data. If depth data is not exist, returns null.

    Returns Nullable<number>

  • get latestDepthBuffer(): Nullable<ArrayBufferView>
  • cached depth buffer

    Returns Nullable<ArrayBufferView>

  • Latest cached Texture of depth image which is made from the depth buffer data.

    Returns Nullable<RawTexture>

  • Latest cached InternalTexture which containing depth buffer information. This can be used when the depth usage is "gpu".

    Returns Nullable<InternalTexture>

  • An XRRigidTransform that needs to be applied when indexing into the depth buffer.

    Returns Nullable<XRRigidTransform>

  • get rawValueToMeters(): Nullable<number>
  • Scale factor by which the raw depth values must be multiplied in order to get the depths in meters.

    Returns Nullable<number>

  • Width of depth data. If depth data is not exist, returns null.

    Returns Nullable<number>


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


    • Optional force: boolean

    Returns boolean

    true if successful.

  • 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

  • Extends the session init object if needed

    Returns Promise<Partial<XRSessionInit>>

    augmentation object for the xr session init object.

  • 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
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static property
  • Static method