WebXR Anchors Module: Difference between revisions

From WebXR Wiki
Jump to navigation Jump to search
(Add boilerplate information)
(Add short summary and WebIDL)
 
Line 6: Line 6:
  |group = WG
  |group = WG
}}
}}
The WebXR Anchors module enables applications to ask the underlying XR system to track changes to a particular three-dimensional pose (position and orientation) as the system’s understanding of the world changes. This allows the application to adjust the location of the virtual objects that it placed in the scene in a way that helps with maintaining the illusion that the placed objects are really present in the user’s environment.
==WebIDL==
<syntaxhighlight lang="idl">
[SecureContext, Exposed=Window]
interface XRAnchor {
  readonly attribute XRSpace anchorSpace;
  Promise<DOMString> requestPersistentHandle();
  undefined delete();
};
partial interface XRFrame {
  Promise<XRAnchor> createAnchor(XRRigidTransform pose, XRSpace space);
};
partial interface XRSession {
  Promise<XRAnchor> restorePersistentAnchor(DOMString uuid);
  Promise<undefined> deletePersistentAnchor(DOMString uuid);
};
partial interface XRHitTestResult {
  Promise<XRAnchor> createAnchor();
};
[Exposed=Window]
interface XRAnchorSet {
  readonly setlike<XRAnchor>;
};
partial interface XRFrame {
  [SameObject] readonly attribute XRAnchorSet trackedAnchors;
};
</syntaxhighlight>


== External Links ==
== External Links ==

Latest revision as of 01:07, 1 March 2023

WebXR Anchors Module
StatusED
Last Updated30 September 2021
Editor(s)Piotr Bialecki
CG or WG?WG

The WebXR Anchors module enables applications to ask the underlying XR system to track changes to a particular three-dimensional pose (position and orientation) as the system’s understanding of the world changes. This allows the application to adjust the location of the virtual objects that it placed in the scene in a way that helps with maintaining the illusion that the placed objects are really present in the user’s environment.

WebIDL[edit]

[SecureContext, Exposed=Window]
interface XRAnchor {
  readonly attribute XRSpace anchorSpace;

  Promise<DOMString> requestPersistentHandle();

  undefined delete();
};

partial interface XRFrame {
  Promise<XRAnchor> createAnchor(XRRigidTransform pose, XRSpace space);
};

partial interface XRSession {
  Promise<XRAnchor> restorePersistentAnchor(DOMString uuid);
  Promise<undefined> deletePersistentAnchor(DOMString uuid);
};

partial interface XRHitTestResult {
  Promise<XRAnchor> createAnchor();
};

[Exposed=Window]
interface XRAnchorSet {
  readonly setlike<XRAnchor>;
};

partial interface XRFrame {
  [SameObject] readonly attribute XRAnchorSet trackedAnchors;
};

External Links[edit]