Skip to content
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

Added support for angular and linear velocity #1182

Merged
merged 3 commits into from
Mar 14, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ Each time the [=list of immersive XR devices=] changes the user agent should <df
1. If this is the first time devices have been enumerated or |oldDevice| equals the [=immersive XR device=], abort these steps.
1. [=Shut down the session|Shut down=] any active {{XRSession}}s.
1. [=Queue a task=] to set the [=XR compatible=] boolean of all {{WebGLRenderingContextBase}} instances to `false`.
1. [=Queue a task=] to [=fire an event=] named {{devicechange!!event}} on the [=context object=]'s {{Window/navigator}}'s {{Navigator/xr}}.
1. [=Queue a task=] to [=fire an event=] named <a for="XRSystem" data-link-type="event">devicechange</a> on the [=context object=]'s {{Window/navigator}}'s {{Navigator/xr}}.
1. [=Queue a task=] to fire appropriate `change` events on any {{XRPermissionStatus}} objects who are affected by the change in the [=immersive XR device=] or [=/inline XR device=].

Note: These steps should always be run [=in parallel=].
Expand All @@ -324,7 +324,7 @@ Note: These steps should always be run [=in parallel=].

</div>

The <dfn attribute for="XRSystem">ondevicechange</dfn> attribute is an [=Event handler IDL attribute=] for the {{devicechange}} event type.
The <dfn attribute for="XRSystem">ondevicechange</dfn> attribute is an [=Event handler IDL attribute=] for the <a for="XRSystem" data-link-type="event">devicechange</a> event type.

<div class="algorithm" data-algorithm="session-supported">
The <dfn method for="XRSystem">isSessionSupported(|mode|)</dfn> method queries if a given |mode| may be supported by the user agent and device capabilities.
Expand Down Expand Up @@ -1186,16 +1186,22 @@ To <dfn>populate the pose</dfn> of an {{XRSpace}} |space| in an {{XRSpace}} |bas
: If |limit| is `false` and the tracking system provides a [=6DoF=] pose whose position is actively tracked or statically known for |space|'s pose relative to |baseSpace|:
:: Set |transform|'s {{XRRigidTransform/orientation}} to the orientation of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=].
:: Set |transform|'s {{XRRigidTransform/position}} to the position of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=].
:: Set |pose|'s {{XRPose/linearVelocity}} to the linear velocity of |space|'s [=effective origin=] compared to |baseSpace|'s [=coordinate system=].
:: Set |pose|'s {{XRPose/angularVelocity}} to the angular velocity of |space|'s [=effective origin=] compared to |baseSpace|'s [=coordinate system=].
:: Set |pose|'s {{XRPose/emulatedPosition}} to `false`.

: Else if |limit| is `false` and the tracking system provides a [=3DoF=] pose or a [=6DoF=] pose whose position is neither actively tracked nor statically known for |space|'s pose relative to |baseSpace|:
:: Set |transform|'s {{XRRigidTransform/orientation}} to the orientation of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=].
:: Set |transform|'s {{XRRigidTransform/position}} to the tracking system's best estimate of the position of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=]. This MAY include a computed offset such as a neck or arm model. If a position estimate is not available, the last known position MUST be used.
:: Set |pose|'s {{XRPose/linearVelocity}} to `null`.
:: Set |pose|'s {{XRPose/angularVelocity}} to `null`.
:: Set |pose|'s {{XRPose/emulatedPosition}} to `true`.

: Else if |space|'s pose relative to |baseSpace| has been determined in the past and |force emulation| is `true`:
:: Set |transform|'s {{XRRigidTransform/position}} to the last known position of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=].
:: Set |transform|'s {{XRRigidTransform/orientation}} to the last known orientation of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=].
:: Set |pose|'s {{XRPose/linearVelocity}} to `null`.
:: Set |pose|'s {{XRPose/angularVelocity}} to `null`.
:: Set |pose|'s {{XRPose/emulatedPosition}} boolean to `true`.

: Otherwise:
Expand Down Expand Up @@ -1689,12 +1695,19 @@ An {{XRPose}} describes a position and orientation in space relative to an {{XRS
<pre class="idl">
[SecureContext, Exposed=Window] interface XRPose {
[SameObject] readonly attribute XRRigidTransform transform;
[SameObject] readonly attribute DOMPointReadOnly? linearVelocity;
[SameObject] readonly attribute DOMPointReadOnly? angularVelocity;

readonly attribute boolean emulatedPosition;
};
</pre>

The <dfn attribute for="XRPose">transform</dfn> attribute describes the position and orientation relative to the base {{XRSpace}}.

The <dfn attribute for="XRPose">linearVelocity</dfn> attribute describes the linear velocity in meters per second relative to the base {{XRSpace}}. If the user agent can't populate this, it's allowed to return <code>null</code>.

The <dfn attribute for="XRPose">angularVelocity</dfn> attribute describes the angular velocity in meters per second relative to the base {{XRSpace}}. If the user agent can't populate this, it's allowed to return <code>null</code>.
cabanier marked this conversation as resolved.
Show resolved Hide resolved

The <dfn attribute for="XRPose">emulatedPosition</dfn> attribute is `false` when the {{XRPose/transform}} represents an actively tracked [=6DoF=] pose based on sensor readings, or `true` if its {{XRRigidTransform/position}} value includes a <dfn for="XRPose">computed offset</dfn>, such as that provided by a neck or arm model. [=Estimated floor level=]s MUST NOT be considered when determining if an {{XRPose}} includes a [=XRPose/computed offset=].

XRViewerPose {#xrviewerpose-interface}
Expand Down Expand Up @@ -2609,7 +2622,7 @@ The trusted UI must be drawn by an independent rendering context whose state is

Also, to prevent CORS-related vulnerabilities each [=browsing context=] will see a new instance of objects returned by the API, such as {{XRSession}}. Attributes such as the [=XRWebGLLayer/context=] set on an {{XRWebGLLayer}} with one [=relevant realm=] should not be able to be read through an {{XRWebGLLayer}} with a [=relevant realm=] that does not have the [=same origin=]. Similarly, methods invoked on the API MUST NOT cause an observable state change on other [=browsing contexts=]. For example: No method will be exposed that enables a system-level orientation reset, as this could be called repeatedly by a malicious page to prevent other pages from tracking properly. The user agent MUST, however, respect system-level orientation resets triggered by a user gesture or system menu.

Note: this doesn't apply to state changes that are caused by one [=browsing context=] entering immersive mode, acquiring a lock on the device, and potentially firing {{devicechange}} events on other [=browsing contexts=].
Note: this doesn't apply to state changes that are caused by one [=browsing context=] entering immersive mode, acquiring a lock on the device, and potentially firing <a for="XRSystem" data-link-type="event">devicechange</a> events on other [=browsing contexts=].

Fingerprinting {#fingerprinting-security}
--------------
Expand Down Expand Up @@ -2677,7 +2690,7 @@ Integrations {#integrations}
Permissions Policy {#permissions-policy}
--------------

This specification defines a [=policy-controlled feature=] that controls whether any {{XRSession}} that requires the use of spatial tracking may be returned by {{XRSystem/requestSession()}}, and whether support for session modes that require spatial tracking may be indicated by either {{XRSystem/isSessionSupported()}} or {{devicechange}} events on the {{Navigator/xr|navigator.xr}} object.
This specification defines a [=policy-controlled feature=] that controls whether any {{XRSession}} that requires the use of spatial tracking may be returned by {{XRSystem/requestSession()}}, and whether support for session modes that require spatial tracking may be indicated by either {{XRSystem/isSessionSupported()}} or <a for="XRSystem" data-link-type="event">devicechange</a> events on the {{Navigator/xr|navigator.xr}} object.

The feature identifier for this feature is `"xr-spatial-tracking"`.

Expand Down