Class WebXRAnchorSystem
Hierarchy
- WebXRAbstractFeature
- WebXRAnchorSystem
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
constructs a new anchor system
Parameters
_xrSessionManager: WebXRSessionManager
an instance of WebXRSessionManager
Optional _options: IWebXRAnchorSystemOptions
configuration object for this feature
Returns WebXRAnchorSystem
Properties
disable Auto AttachSearch playground for disableAutoAttach
Should auto-attach be disabled?
is DisposedSearch playground for isDisposed
Is this feature disposed?
on Anchor Added ObservableSearch playground for onAnchorAddedObservable
Observers registered here will be executed when a new anchor was added to the session
on Anchor Removed ObservableSearch playground for onAnchorRemovedObservable
Observers registered here will be executed when an anchor was removed from the session
on Anchor Updated ObservableSearch playground for onAnchorUpdatedObservable
Observers registered here will be executed when an existing anchor updates This can execute N times every frame
on Feature Attach ObservableSearch playground for onFeatureAttachObservable
Observers registered here will be executed when the feature is attached
on Feature Detach ObservableSearch playground for onFeatureDetachObservable
Observers registered here will be executed when the feature is detached
xr Native Feature NameSearch playground for xrNativeFeatureName
The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
Static Readonly NameSearch playground for Name
The module's name
Static Readonly VersionSearch playground for Version
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
Is this feature attached
Returns boolean
reference Space For Frame Anchors
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
referenceSpace: XRReferenceSpace
Returns void
Methods
add Anchor At Position And Rotation AsyncSearch playground for addAnchorAtPositionAndRotationAsync
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
add Anchor Point Using Hit Test Result AsyncSearch 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 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 this feature. Will usually be called by the features manager
Returns boolean
true if successful.
disposeSearch playground for dispose
Dispose this feature and all of the resources attached
Returns void
is CompatibleSearch playground for isCompatible
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
An implementation of the anchor system for WebXR. For further information see https://github.com/immersive-web/anchors/