Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebXRAnchorSystem

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

Hierarchy

Implements

Index

Constructors

constructor

Properties

disableAutoAttachSearch playground for disableAutoAttach

disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposedSearch playground for isDisposed

isDisposed: boolean

Is this feature disposed?

onAnchorAddedObservableSearch playground for onAnchorAddedObservable

onAnchorAddedObservable: Observable<IWebXRAnchor>

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

onAnchorRemovedObservableSearch playground for onAnchorRemovedObservable

onAnchorRemovedObservable: Observable<IWebXRAnchor>

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

onAnchorUpdatedObservableSearch playground for onAnchorUpdatedObservable

onAnchorUpdatedObservable: Observable<IWebXRAnchor>

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

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: "xr-anchor-system" = "xr-anchor-system"

The module's name

Static Readonly VersionSearch playground for Version

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

Accessors

anchors

  • Get the list of anchors currently being tracked by the system

    Returns IWebXRAnchor[]

attached

  • get attached(): boolean

referenceSpaceForFrameAnchors

  • 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

addAnchorAtPositionAndRotationAsyncSearch playground for addAnchorAtPositionAndRotationAsync

  • addAnchorAtPositionAndRotationAsync(position: Vector3, rotationQuaternion?: Quaternion, forceCreateInCurrentFrame?: boolean): Promise<IWebXRAnchor>
  • 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<IWebXRAnchor>

    A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun

addAnchorPointUsingHitTestResultAsyncSearch playground for addAnchorPointUsingHitTestResultAsync

  • 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<IWebXRAnchor>

    A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun

attachSearch playground for attach

  • 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

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

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

Legend

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