-
Notifications
You must be signed in to change notification settings - Fork 410
Updated the explainer with new origin offset mechanics. #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions/comments...
|
Addressed feedback. PTAL! |
| y: currentOrigin.position.y + deltaY, | ||
| z: currentOrigin.position.z + deltaZ }, | ||
| currentOrigin.orientation); | ||
| xrReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to see a super-specific example of how a reference space and an offset reference space interact, not just how they can be used. Would it make sense to add something like this?
For example:
offsetSpace = xrReferenceSpace.getOffsetReferenceSpace(new XRRigidTransform({x: 1, y:0, z:0});
// (0,0,0) in offsetSpace coordinates is (1,0,0) in xrReferenceSpace coordinates.
Similar for chained offsets to make it extra clear how they are chained.
offsetSpace1 = xrReferenceSpace.getOffsetReferenceSpace(new XRRigidTransform({x: 1,y: 0, z: 0});
offsetSpace2 = offsetSpace1.getOffsetReferenceSpace(<rotation around y axes by 180>);
(0,0,0) in offsetSpace2 is (0,0,0) in offsetspace1 is (1, 0, 0) in xrReferenceSpace, but
(1,0,0) in offsetSpace2 is (-1,0,0) in offsetSpace1 is (0,0,0) in xrReferenceSpace.
|
@billorr-google wrote:
I'd love to see a super-specific example of how a reference space and an
offset reference space interact, not just how they can be used. Would it
make sense to add something like this?
FWIW, I had a specific example in my old PR:
https://github.com/immersive-web/webxr/pull/569/files#diff-f02c24f867e61b8e58dc8f2c228f476cR259
*From: *billorr-google <notifications@github.com>
*Date: *Tue, May 14, 2019 at 5:10 PM
*To: *immersive-web/webxr
*Cc: *Klaus Weidner, Comment
*@billorr-google* commented on this pull request.
… ------------------------------
In spatial-tracking-explainer.md
<#642 (comment)>:
>
A common use case for this attribute would be for a "teleportation" mechanic, where the user "jumps" to a new point in the virtual scene, after which the selected point is treated as the new virtual origin which all tracked motion is relative to.
```js
// Teleport the user a certain number of meters along the X, Y, and Z axes
function teleport(deltaX, deltaY, deltaZ) {
- let currentOrigin = xrReferenceSpace.originOffset;
- xrReferenceSpace.originOffset = new XRRigidTransform(
- { x: currentOrigin.position.x + deltaX,
- y: currentOrigin.position.y + deltaY,
- z: currentOrigin.position.z + deltaZ },
- currentOrigin.orientation);
+ xrReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace(
I'd love to see a super-specific example of how a reference space and an
offset reference space interact, not just how they can be used. Would it
make sense to add something like this?
For example:
offsetSpace = xrReferenceSpace.getOffsetReferenceSpace(new
XRRigidTransform({x: 1, y:0, z:0});
// (0,0,0) in offsetSpace coordinates is (1,0,0) in xrReferenceSpace
coordinates.
Similar for chained offsets to make it extra clear how they are chained.
offsetSpace1 = xrReferenceSpace.getOffsetReferenceSpace(new
XRRigidTransform({x: 1,y: 0, z: 0});
offsetSpace2 = offsetSpace1.getOffsetReferenceSpace(<rotation around y
axes by 180>);
(0,0,0) in offsetSpace2 is (0,0,0) in offsetspace1 is (1, 0, 0) in
xrReferenceSpace, but
(1,0,0) in offsetSpace2 is (-1,0,0) in offsetSpace1 is (0,0,0) in
xrReferenceSpace.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#642?email_source=notifications&email_token=AAKT5XYNFBNL5YS7ZVTLAFTPVNII7A5CNFSM4HM5SJ5KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBYUNX3Y#pullrequestreview-237558767>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKT5XZOJMZF6AUOBS5G7KDPVNII7ANCNFSM4HM5SJ5A>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we close to landing this one? I know that @thetuvix is blocked so he can rebase on it...
spatial-tracking-explainer.md
Outdated
| Frequently developers will want to provide an additional, artificial transform on top of the user's tracked motion to allow the user to navigate larger virtual scenes than their tracking systems or physical space allows. This effect is traditionally accomplished by mathematically combining the API-provided transform with the desired additional application transforms. WebXR offers developers a simplification to ensure that all tracked values, such as viewer and input poses, are transformed consistently. | ||
|
|
||
| Developers can specify application-specific transforms by setting the `originOffset` attribute of any `XRReferenceSpace`. The `originOffset` is initialized to an identity transform, and any values queried using the `XRReferenceSpace` will be offset by the `position` and `orientation` the `originOffset` describes. The `XRReferenceSpace`'s `originOffset` can be updated at any time and will immediately take effect, meaning that any subsequent poses queried with the `XRReferenceSpace` will take into account the new `originOffset`. Previously queried values will not be altered. Changing the `originOffset` between pose queries in a single frame is not advised, since it will cause inconsistencies in the tracking data and rendered output. | ||
| Developers can specify application-specific transforms by calling the getOffsetReferenceSpace() method of any XRReferenceSpace. This returns a new XRReferenceSpace where the XRRigidTransform passed to getOffsetReferenceSpace() describes the position and orientation of the offset space's origin in relation to the base reference space's origin. Specifically, originOffset.position contains the coordinates of the new origin relative to the base reference space's origin. If the base reference space was also created with getOffsetReferenceSpace(), the overall offset is the combination of both transforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically, originOffset.position contains the coordinates of the new origin relative to the base reference space's origin.
Seems strange to be calling out position, but not orientation. Almost implies that orientation is ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems strange to be calling out position, but not orientation. Almost implies that orientation is ignored.
That wasn't the intent, a reason for having this here is that it's a fairly straightforward example that's easy to sanity check in terms of coordinates, and the previous sentence already mentioned "position and orientation". It's difficult to make a short-but-concrete example based on quaternions.
We could add something along these lines, but I think this may get clunky?
... and originOffset.orientation is a quaternion representing a rotation that transforms vectors in offset space coordinates to their coordinate values in the base reference space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, if we could centrally establish once in the spec that a "pose" is a position and orientation applied in a specific order within a base space, we could easily and consistently describe all such use of poses throughout the spec in a straightforward manner:
This returns a new XRReferenceSpace where the XRRigidTransform passed to getOffsetReferenceSpace() describes the pose of the offset space's origin within the base space.
/fixes #634