• Public
  • Public/Protected
  • All

Class WebXRNearInteraction

A module that will enable near interaction near interaction for hands and motion controllers of XR Input Sources







disableAutoAttachSearch playground for disableAutoAttach

disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposedSearch playground for isDisposed

isDisposed: boolean

Is this feature disposed?

selectionMeshDefaultColorSearch playground for selectionMeshDefaultColor

selectionMeshDefaultColor: Color3

default color of the selection ring

selectionMeshPickedColorSearch playground for selectionMeshPickedColor

selectionMeshPickedColor: Color3

This color will be applied to the selection ring when selection is triggered

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
  • Detach this feature. Will usually be called by the features manager

    Returns boolean

    true if successful.

disposeSearch playground for dispose

  • dispose(): void

getMeshUnderPointerSearch playground for getMeshUnderPointer

  • Will get the mesh under a specific pointer. scene.meshUnderPointer will only return one mesh - either left or right.


    • controllerId: string

      the controllerId to check

    Returns Nullable<AbstractMesh>

    The mesh under pointer or null if no mesh is under the pointer

getXRControllerByPointerIdSearch playground for getXRControllerByPointerId

  • Get the xr controller that correlates to the pointer id in the pointer event


    • id: number

      the pointer id to search for

    Returns Nullable<WebXRInputSource>

    the controller that correlates to this id or null if not found

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

setFarInteractionFeatureSearch playground for setFarInteractionFeature

  • This function sets webXRControllerPointerSelection feature that will be disabled when the hover range is reached for a mesh and will be reattached when not in hover range. This is used to remove the selection rays when moving.


    Returns void

Static PickMeshWithSphereSearch playground for PickMeshWithSphere

  • Picks a mesh with a sphere


    • mesh: AbstractMesh

      the mesh to pick

    • sphere: BoundingSphere

      picking sphere in world coordinates

    • Optional skipBoundingInfo: boolean

      a boolean indicating if we should skip the bounding info check

    Returns PickingInfo

    the picking info


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