WebXRAnchorSystem

An implementation of the anchor system for WebXR. For further information see https://github.com/immersive-web/anchors/

Hierarchy

Implements

Index

Constructors

constructor

Find examples in Playground

Properties

disableAutoAttach

Find examples in Playground
disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposed

Find examples in Playground
isDisposed: boolean

Is this feature disposed?

onAnchorAddedObservable

Find examples in Playground
onAnchorAddedObservable: Observable<IWebXRAnchor>

Observers registered here will be executed when a new anchor was added to the session

onAnchorRemovedObservable

Find examples in Playground
onAnchorRemovedObservable: Observable<IWebXRAnchor>

Observers registered here will be executed when an anchor was removed from the session

onAnchorUpdatedObservable

Find examples in Playground
onAnchorUpdatedObservable: Observable<IWebXRAnchor>

Observers registered here will be executed when an existing anchor updates This can execute N times every frame

xrNativeFeatureName

Find examples in Playground
xrNativeFeatureName: string

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

Static Readonly Name

Find examples in Playground
Name: string

The module's name

Static Readonly Version

Find examples in Playground
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

Accessors

attached

Find examples in Playground
  • get attached(): boolean

referenceSpaceForFrameAnchors

Find examples in Playground
  • Set the reference space to use for anchor creation, when not using a hit test. Will default to the session's reference space if not defined

    Parameters

    Returns any

Methods

addAnchorAtPositionAndRotationAsync

Find examples in Playground
  • addAnchorAtPositionAndRotationAsync(position: Vector3, rotationQuaternion?: Quaternion, forceCreateInCurrentFrame?: boolean): Promise<XRAnchor>
  • Add a new anchor at a specific position and rotation This function will add a new anchor per default in the next available frame. Unless forced, the createAnchor function will be called in the next xrFrame loop to make sure that the anchor can be created correctly. An anchor is tracked only after it is added to the trackerAnchors in xrFrame. The promise returned here does not yet guaranty that. Use onAnchorAddedObservable to get newly added anchors if you require tracking guaranty.

    Parameters

    • position: Vector3

      the position in which to add an anchor

    • Optional rotationQuaternion: Quaternion

      an optional rotation for the anchor transformation

    • Optional forceCreateInCurrentFrame: boolean

      force the creation of this anchor in the current frame. Must be called inside xrFrame loop!

    Returns Promise<XRAnchor>

    A promise that fulfills when the XR anchor was registered in the system (but not necessarily added to the tracked anchors)

addAnchorPointUsingHitTestResultAsync

Find examples in Playground
  • Create a new anchor point using a hit test result at a specific point in the scene An anchor is tracked only after it is added to the trackerAnchors in xrFrame. The promise returned here does not yet guaranty that. Use onAnchorAddedObservable to get newly added anchors if you require tracking guaranty.

    Parameters

    • hitTestResult: IWebXRHitResult

      The hit test result to use for this anchor creation

    • Optional position: Vector3

      an optional position offset for this anchor

    • Optional rotationQuaternion: Quaternion

      an optional rotation offset for this anchor

    Returns Promise<XRAnchor>

    A promise that fulfills when the XR anchor was registered in the system (but not necessarily added to the tracked anchors)

attach

Find examples in Playground
  • attach(force?: boolean): boolean
  • attach this feature

    Parameters

    • Optional force: boolean

      should attachment be forced (even when already attached)

    Returns boolean

    true if successful, false is failed or already attached

detach

Find examples in Playground
  • detach(): boolean

dispose

Find examples in Playground
  • dispose(): void

isCompatible

Find examples in Playground
  • 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

Generated using TypeDoc