Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

Index

Constructors

Properties

disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposed: boolean

Is this feature disposed?

onAnchorAddedObservable: Observable<IWebXRAnchor>

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

onAnchorRemovedObservable: Observable<IWebXRAnchor>

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

onAnchorUpdatedObservable: Observable<IWebXRAnchor>

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

xrNativeFeatureName: string

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

Name: "xr-anchor-system" = "xr-anchor-system"

The module's name

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

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

    Returns IWebXRAnchor[]

  • get attached(): boolean
  • Is this feature attached

    Returns boolean

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

Methods

  • 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

  • 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

  • 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(): boolean
  • detach this feature. Will usually be called by the features manager

    Returns boolean

    true if successful.

  • dispose(): void
  • Dispose this feature and all of the resources attached

    Returns void

  • 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
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static property
  • Static method

Settings

Theme