• Public
  • Public/Protected
  • All

Class WebXRHitTest

The currently-working hit-test module. Hit test (or Ray-casting) is used to interact with the real world. For further information read here - https://github.com/immersive-web/hit-test

Tested on chrome (mobile) 80.







autoCloneTransformationSearch playground for autoCloneTransformation

autoCloneTransformation: boolean

When set to true, each hit test will have its own position/rotation objects When set to false, position and rotation objects will be reused for each hit test. It is expected that the developers will clone them or copy them as they see fit.

disableAutoAttachSearch playground for disableAutoAttach

disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposedSearch playground for isDisposed

isDisposed: boolean

Is this feature disposed?

onHitTestResultObservableSearch playground for onHitTestResultObservable

onHitTestResultObservable: Observable<IWebXRHitResult[]>

Triggered when new babylon (transformed) hit test results are available Note - this will be called when results come back from the device. It can be an empty array!!

Readonly optionsSearch playground for options

options to use when constructing this feature

pausedSearch playground for paused

paused: boolean

Use this to temporarily pause hit test checks.

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


attachSearch playground for attach

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

    Returns boolean

    true if successful.

detachSearch playground for detach

  • detach(): boolean

disposeSearch playground for dispose

  • dispose(): void

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