API

Class WebXRHitTestLegacy

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

Hierarchy (View Summary)

Implements

Index
dependsOn?: string[]

The dependencies of this feature, if any

disableAutoAttach: boolean = false

Should auto-attach be disabled?

isDisposed: boolean = false

Is this feature disposed?

lastNativeXRHitResults: XRHitResult[] = []

Populated with the last native XR Hit Results

onFeatureAttachObservable: Observable<IWebXRFeature> = ...

Observers registered here will be executed when the feature is attached

onFeatureDetachObservable: Observable<IWebXRFeature> = ...

Observers registered here will be executed when the feature is detached

onHitTestResultObservable: Observable<IWebXRLegacyHitResult[]> = ...

Triggered when new babylon (transformed) hit test results are available

[Empty Object] options to use when constructing this feature

Name: "xr-hit-test" = WebXRFeatureName.HIT_TEST

The module's name

Version: 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

  • execute a hit test with an XR Ray

    Parameters

    • xrSession: XRSession

      a native xrSession that will execute this hit test

    • xrRay: XRRay

      the ray (position and direction) to use for ray-casting

    • referenceSpace: XRReferenceSpace

      native XR reference space to use for the hit-test

    • Optionalfilter: (result: XRHitResult) => boolean

      filter function that will filter the results

    Returns Promise<XRHitResult[]>

    a promise that resolves with an array of native XR hit result in xr coordinates system

  • Execute a hit test on the current running session using a select event returned from a transient input (such as touch)

    Parameters

    • event: XRInputSourceEvent

      the (select) event to use to select with

    • referenceSpace: XRReferenceSpace

      the reference space to use for this hit test

    Returns Promise<XRHitResult[]>

    a promise that resolves with an array of native XR hit result in xr coordinates system