API

Interface IWebXRHitTestFeature<T>

An interface for all Hit test features

interface IWebXRHitTestFeature<T extends IWebXRLegacyHitResult> {
    attached: boolean;
    dependsOn?: string[];
    disableAutoAttach: boolean;
    getXRSessionInitExtension?: () => Promise<XRSessionInit>;
    isDisposed: boolean;
    onFeatureAttachObservable: Observable<IWebXRFeature>;
    onFeatureDetachObservable: Observable<IWebXRFeature>;
    onHitTestResultObservable: Observable<T[]>;
    xrNativeFeatureName?: string;
    attach(force?: boolean): boolean;
    detach(): boolean;
    dispose(): void;
    isCompatible(): boolean;
}

Type Parameters

Hierarchy (View Summary)

Implemented by

Index
attached: boolean

Is this feature attached

dependsOn?: string[]

A list of (Babylon WebXR) features this feature depends on

disableAutoAttach: boolean

Should auto-attach be disabled?

getXRSessionInitExtension?: () => Promise<XRSessionInit>

If this feature requires to extend the XRSessionInit object, this function will return the partial XR session init object

isDisposed: boolean

Was this feature disposed;

onFeatureAttachObservable: Observable<IWebXRFeature>

Triggered when the feature is attached

onFeatureDetachObservable: Observable<IWebXRFeature>

Triggered when the feature is detached

onHitTestResultObservable: Observable<T[]>

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

xrNativeFeatureName?: string

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

  • 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