Closed Bug 1355648 Opened 7 years ago Closed 7 years ago

Add hasOrientation, hasPosition to the Gamepad extension for tracked controllers

Categories

(Core :: WebVR, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: dmarcos, Assigned: daoshengmu)

References

()

Details

(Keywords: dev-doc-complete)

Attachments

(3 files)

This way we can discriminate tracked gamepads consistently since the pose is not always available. It will make the API also consistent with VRDisplay API:

https://w3c.github.io/webvr/spec/1.1/#interface-vrdisplaycapabilities
Summarize our discussion:

We will want hasOrientation() and hasPosition() to be true if the sensors for orientation and position are present, even if the device can't get it's tracking position

Should be a three-state logic effectively:


State A - We can't measure our position and will never give you a position

State B - We can measure our position, but don't know our position right now

State C - We can measure our position, and this is the position


hasPosition() should return true for B and C, but false for A

"pose" should never be null, but the position values can be null for A and B. Same thing for orientation..
Assignee: nobody → dmu
As the spec [1] mentioned, "MUST be null if the gamepad is incapable of providing positional data. When not null, MUST be a three-element array."

[1] https://w3c.github.io/gamepad/extensions.html#gamepadpose-interface
Comment on attachment 8860341 [details]
Bug 1355648 - Part 1: Check VR controllers if losing tracking;

https://reviewboard.mozilla.org/r/132380/#review135438

LGTM, Thanks!
Attachment #8860341 - Flags: review?(kgilbert) → review+
Comment on attachment 8860342 [details]
Bug 1355648 - Part 2: Handle GampadPose losing tracking situation;

https://reviewboard.mozilla.org/r/132382/#review135440

LGTM
Attachment #8860342 - Flags: review?(kgilbert) → review+
Comment on attachment 8860342 [details]
Bug 1355648 - Part 2: Handle GampadPose losing tracking situation;

https://reviewboard.mozilla.org/r/132382/#review136364
Attachment #8860342 - Flags: review?(kyle) → review+
Pushed by dmu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f07c7d6ddb8d
Part 1: Check VR controllers if losing tracking; r=kip
https://hg.mozilla.org/integration/autoland/rev/1a675abcc1f0
Part 2: Handle GampadPose losing tracking situation; r=kip,qdot
In Attachment #8861769 [details], fixing GamepadPose test for GamepadServiceTest and VRServiceTest.
Comment on attachment 8861769 [details]
Bug 1355648 - Part 3: Set position and orientation IsValid properties for GamepadPose tests;

https://reviewboard.mozilla.org/r/133772/#review137062

LGTM, Thanks!
Attachment #8861769 - Flags: review?(kgilbert) → review+
Pushed by dmu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d9eb118a1ac8
Part 1: Check VR controllers if losing tracking; r=kip
https://hg.mozilla.org/integration/autoland/rev/574ebf5abbfa
Part 2: Handle GampadPose losing tracking situation; r=kip,qdot
https://hg.mozilla.org/integration/autoland/rev/efa1d4ebbc3d
Part 3: Set position and orientation IsValid properties for GamepadPose tests; r=kip
I don't think I need to add anything to the reference docs to cover this - I already documented VRDisplayCapabilities

https://developer.mozilla.org/en-US/docs/Web/API/VRDisplayCapabilities

And I was planning on adding a separate tutorial on how to handle VR controllers in a web app.

Let me know if you think anything else is needed. Thanks!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: