Skip to content

Commit f0fbbe6

Browse files
committed
Tighten up spec text around native origins
1 parent e511948 commit f0fbbe6

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

index.bs

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<pre class="metadata">
1+
{<pre class="metadata">
22
Shortname: webxr-anchors
33
Title: WebXR Anchors Module
44
Group: immersivewebcg
@@ -42,6 +42,8 @@ spec: WebXR Device API - Level 1; urlPrefix: https://www.w3.org/TR/webxr/#
4242
type: dfn; text: identity transform; url: identity-transform
4343
type: dfn; text: inline XR device; url: inline-xr-device
4444
type: dfn; text: XR device; url: xr-device
45+
type:dfn; text: native origin
46+
type:dfn; text: multiply transforms
4547
spec: WebXR Hit Test Module; urlPrefix: https://immersive-web.github.io/hit-test/#
4648
type: interface; text: XRHitTestResult; url: xrhittestresult
4749
for: XRHitTestResult;
@@ -150,17 +152,30 @@ An {{XRAnchor}} contains {{XRAnchor/anchorSpace}} that can be used to locate the
150152

151153
Each {{XRAnchor}} has an associated <dfn for=XRAnchor>deleted</dfn> boolean value that is initially set to <code>false</code>.
152154

153-
Each {{XRAnchor}} has an associated <dfn for=XRAnchor>native origin</dfn>.
155+
An {{XRAnchor}} may have an associated <dfn for=XRAnchor>tracked entity</dfn>, which is a [=native entity=] that it is [=attached=] to.
156+
157+
An {{XRAnchor}} may have an associated <dfn for=XRAnchor>static origin</dfn>, which is a position and orientation in world space. An {{XRAnchor}} returned to the user MUST either have a [=XRAnchor/tracked entity=] or an [=XRAnchor/static origin=].
158+
159+
Each {{XRAnchor}} has an associated <dfn for=XRAnchor>offset pose</dfn>, which is an {{XRRigidTransform}}.
154160

155161
Each {{XRAnchor}} has an associated <dfn for=XRAnchor>session</dfn>.
156162

163+
Each {{XRSpace}} obtained from {{XRAnchor/anchorSpace}} has an <dfn for=XRSpace>associated anchor</dfn> that is the {{XRAnchor}} that created it. The [=XRSpace/native origin=] of an {{XRSpace}} with an [=associated anchor=] is the [=XRAnchor/native origin=] of the [=associated anchor=].
164+
165+
Each {{XRAnchor}} has a <dfn for=XRAnchor>native origin</dfn> defined as follows:
166+
167+
- If the {{XRAnchor}} has a [=XRAnchor/tracked entity=] defined, it is the [=native entity/entity origin=] of the [=XRAnchor/tracked entity=], offset by [=offset pose=]. In other words it is the [=multiply transforms|multiplication=] of [=offset pose=] and the [=native entity/entity origin=] of the [=native entity=].
168+
169+
- If the {{XRAnchor}} has a [=XRAnchor/static origin=] defined, it is the [=multiply transforms|multiplication=] of [=offset pose=] and the [=static origin=].
170+
157171
<div class="algorithm" data-algorithm="create-anchor-object">
158-
In order to <dfn>create new anchor object</dfn> from |native origin| and |session|, the user agent MUST run the following steps:
172+
In order to <dfn>create new anchor object</dfn> from |session|, the user agent MUST run the following steps:
159173
1. Let |anchor| be a new {{XRAnchor}}.
160-
1. Set |anchor|'s [=XRAnchor/native origin=] to |native origin|.
161174
1. Set |anchor|'s [=XRAnchor/session=] to |session|.
162175
1. Set |anchor|'s [=XRAnchor/deleted=] to <code>false</code>.
163-
1. Set |anchor|'s {{XRAnchor/anchorSpace}} to a new {{XRSpace}} object created with [=XRSpace/session=] set to |anchor|'s [=XRAnchor/session=] and [=XRSpace/native origin=] set to [=XRAnchor/native origin=].
176+
1. Set |anchor|'s [=XRAnchor/static origin=] to <code>null</code>.
177+
1. Set |anchor|'s [=XRAnchor/tracked entity=] to <code>null</code>.
178+
1. Set |anchor|'s {{XRAnchor/anchorSpace}} to a new {{XRSpace}} object created with [=XRSpace/session=] set to |anchor|'s [=XRAnchor/session=] and [=XRSpace/associated anchor=] set to |anchor|.
164179
1. Return |anchor|.
165180
</div>
166181

@@ -183,6 +198,8 @@ partial interface XRHitTestResult {
183198

184199
The {{XRHitTestResult}} is extended to contain an associated <dfn for=XRHitTestResult>native entity</dfn>. If the underlying system does not provide information about native entity that resulted in computing the result, it will be assumed that [=XRHitTestResult/native entity=] is set to <code>null</code>.
185200

201+
The [=XRHitTestResult/native entity=] will have an associated <dfn for="native entity">entity origin</dfn> which is its position and orientation. During the [=XRHitTestResult/frame=] of the {{XRHitTestResult}}, the [=native entity/entity origin=] is initialized to the [=XRHitTestResult/native origin=] of the {{XRHitTestResult}}, and it will track the [=native entity=] as it moves in space thereafter.
202+
186203
The application can create an anchor using one of the 2 ways:
187204
- By [=create an anchor from frame|creating an anchor from frame=] - created anchor will not be attached to any particular real world object.
188205
- By [=create an anchor from hit test result|creating an anchor from hit test result=] - created anchor will be attached to a real world object if the underlying [=/XR device=] supports it.
@@ -195,17 +212,19 @@ The {{XRFrame/createAnchor(pose, space)}} method, when invoked on an {{XRFrame}}
195212
1. If |frame|'s [=XRFrame/active=] boolean is <code>false</code>, [=/reject=] |promise| with {{InvalidStateError}} and abort these steps.
196213
1. Let |session| be |frame|'s [=XRFrame/session=].
197214
1. Add [=update anchors=] algorithm to |session|’s [=XRSession/list of frame updates=] if it is not already present there.
198-
1. Let |device| be |session|'s [=XRSession/XR device=].
199215
1. Let |effective origin| be |space|'s [=XRSpace/effective origin=].
200-
1. Let |anchor native origin| be a new native origin returned from the |device|'s call to create a new anchor using |pose|, interpreted as if expressed relative to |effective origin| at the |frame|'s [=XRFrame/time=].
201-
1. [=Create new anchor object=] |anchor| using |anchor native origin| and |session|.
216+
1. [=Create new anchor object=] |anchor| using |session|.
217+
1. Set |anchor|'s [=static origin=] to the current value of |effective origin|.
218+
1. Set |anchor|'s [=offset pose=] to |pose|.
202219
1. Add |anchor| to |session|'s [=XRSession/set of tracked anchors=].
203220
1. Add a mapping from |anchor| to |promise| to |session|'s [=XRSession/map of new anchors=].
204221
1. Return |promise|.
205-
</div>
206222

207223
Note: It is the responsibility of user agents to ensure that the physical origin tracked by the anchor returned by each {{XRFrame/createAnchor(pose, space)}} call aligns as closely as possible with the physical location of |pose| within |space| at the time represented by the frame on which the method is called. Specifically, this means that for spaces that are dynamically changing, user agents should attempt to capture the native origin of such spaces at the app's specified time. This text is non-normative, but expresses the intent of the specification author(s) and contributors and thus it is highly recommended that it is followed by the implementations to ensure consistent behavior across different vendors.
208224

225+
</div>
226+
227+
209228
In order to <dfn>create an anchor from hit test result</dfn>, the application can call {{XRHitTestResult}}'s {{XRHitTestResult/createAnchor(pose)}} method.
210229

211230
<div class="algorithm" data-algorithm="create-anchor-from-hit-test-result">
@@ -215,11 +234,10 @@ The {{XRHitTestResult/createAnchor(pose)}} method, when invoked on an {{XRHitTes
215234
1. If |frame|'s [=XRFrame/active=] boolean is <code>false</code>, [=/reject=] |promise| with {{InvalidStateError}} and abort these steps.
216235
1. Let |session| be |frame|'s [=XRFrame/session=].
217236
1. Add [=update anchors=] algorithm to |session|’s [=XRSession/list of frame updates=] if it is not already present there.
218-
1. Let |device| be |session|'s [=XRSession/XR device=].
219237
1. Let |nativeEntity| be the |hitTestResult|'s [=XRHitTestResult/native entity=].
220-
1. Let |anchor native origin| be a new native origin returned from the |device|'s call to create a new anchor using |pose|, interpreted as if expressed relative to |hitTestResult|'s [=XRHitTestResult/native origin=] and [=attached=] to |nativeEntity|, at the |frame|'s [=XRFrame/time=].
221-
1. [=Create new anchor object=] |anchor| using |anchor native origin| and |session|.
222-
1. Add |anchor| to |session|'s [=XRSession/set of tracked anchors=].
238+
1. [=Create new anchor object=] |anchor| using |session|.
239+
1. Set |anchor|'s [=tracked entity=] to |nativeEntity|.
240+
1. Set |anchor|'s [=offset pose=] to |pose|.
223241
1. Add a mapping from |anchor| to |promise| to |session|'s [=XRSession/map of new anchors=].
224242
1. Return |promise|.
225243
</div>
@@ -293,7 +311,6 @@ The underlying [=XR device=] is [=capable of supporting=] the [=anchors=] featur
293311
- The native anchors API attempts to maintain the pose of the anchor as if it were fixed relative to the real world.
294312
- It accepts pose of the newly created anchor at some specific time <code>t</code>.
295313
- It optionally accepts a native entity information in order to express the intent of [=attached|attaching=] newly created anchor to the given entity. If the underlying XR system does not support attaching anchors to a native entity (i.e. does not accept a native entity), the newly created anchor will be free-floating.
296-
- It returns a result that can be treated as a [=native origin=] by the user agents.
297314
- Native anchors are continuously <dfn>tracked</dfn> by the underlying XR system and can be queried for their most up-to-date state. When the underlying system deems that the native anchor's location is never going to be known, it SHOULD report that the native anchor is no longer tracked.
298315
- Optionally, native anchors can be <dfn>attached</dfn> to native entities. A native anchor that is attached to a native entity attempts to maintain its position fixed relative to the entity to which it is attached (as opposed to the real world in case of free-floating anchors). When the device detects that the pose of the object to which the anchor is attached changes, the anchor will be updated accordingly. This does not imply that the object itself moved - it may be that the system's understanding of its location changed. If the underlying system is capable of tracking moving objects, the native anchors attached to moving objects should be updated as well.
299316

0 commit comments

Comments
 (0)