-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add startSqueezing/endSqueezing/simulateSqueeze #49
Comments
Yeah, we should add these |
I'm a little hesitant on this. The select button is required on an XRInputSource, and as such we didn't define the select button in FakeXrButtonType. However, the grip does exist in FakeXrButtonType, so these would really just be a convenience wrapper around updateButtonState |
It's possible for an XR device to support squeeze but not a gamepad (we're doing this for hands on Hololens) |
updateButtonState doesn't require gamepad though? It still feels wrong to expose two ways of doing the same thing |
Oh, I see. Yeah. However: I don't think the updateButtonState can simulate cancellation; which is possible for both select and squeeze events (and leads to a selectend event not paired with a select event). Not a big deal, but something to think about. |
I don't think our mechanism for select can simulate cancellation right now? we have startSelection/endSelection and then simulateSelect, which from the explainer is a subframe select (so guaranteed to send the select on the next frame, which I think calling startSelection/endSelection may not guarantee) |
One compromise here could be to allow the webxr_util class to polyfill in such a helper. (at least for the start/stop) |
Hmm, we perhaps should change the APIs then to startSelect/endSelect/cancelSelect? That maps more cleanly to the "start, end, cancel" framing that's in the spec: https://immersive-web.github.io/webxr/#primary-squeeze-action IMO this API should hook directly into such spec algorithms (which are triggered by the device) as much as possible. Basically, wherever the core spec ends up in a "obtain this data from the device" or "when the device decides to do X", we should have an API for that. |
In the current test API this hooks more directly into the user side rather than the device side. |
Also, if we're doing this, it might be worth having just startSelect/endSelect/cancelSelect with a |
That kind of feels like overriding the existing method for the sake of not adding a new one, in a way that feels neither scalable nor intuitive IMO |
That's fair. We can also add a new one then. |
If we're okay with removing one (that we maybe keep polyfilled in) We could also do something like
where currently
|
Though "squeeze" would still be possible via updateButtonState, unless we wanted to explicitly disallow that. |
So, should the implementation of updateButtonState check, that the button[1] has been changed, therefore fire the squeeze event? Currently, it just updates the gamepad object (in Chromium implementation) and this doesn't and wouldn't cause the squeeze events firing. Also, should the updating button[0] cause select events to fire somehow? EDIT: talked to Alex offline, seems like it is just an issue in Google's implementation of updateButtonState and it indeed should fire select/squeeze events.... |
The goal of the Test API has been to mimic a "real" device. updateButtonState is our way of saying "Hey, when you next check for data pretend that the state of this button has changed" Updating button[0] (since this is the gamepad button that maps to the select event) should fire that event. However, the way that we have currently designed the API (taking a FakeXrButtonType which doesn't include "select"), makes it impossible to update the select state via "updateButtonState" |
The enum solution sounds good to me! |
Actually, that still leaves us with two ways to press some buttons.
I think all of these except the removal of selectionStarted/selectionClicked can be polyfilled back-in or otherwise backwards compatibly added, unless we're okay with the compat breaking changes. If we are okay with compat breaking changes, We may want to change FakeXRButtonType (and similar) to something like FakeXRActionType (and similar) to make it more generic for Hands and other forms of input. |
The thing that gives me pause is that the FakeXRButton stuff contains a lot of gamepad stuff as well, and ideally that would be separate (we don't implement it). But otherwise this seems fine. I'm also okay with the compat breaking changes, really.
The hands api isn't fixed enough for this to make sense, yet. |
I don't think that would be a major issue. Your implementation can simply ignore buttons it doesn't know/doesn't want to handle. Really the only place that the state of those other buttons should bubble up would be via the Gamepad/gamepad tests. So as long as you just ignore the values, the other tests should be fine?
While I understand that, if we were to bubble up any additional events, they would likely be considered an "Input Action" hence my proposal to name them FakeXRActionType rather than FakeXRButtonType I don't believe we can do partial enums, but I think it would be fine to add spec text to say that certain enum values may not be supported if they are required by a module that the UA doesn't support. |
This is fine.
I believe the current thinking is that hands will also have select and squeeze events, and nothing more, everything else is exposed as state and not events. |
To match the 'select' event testing, why don't we add the startSqueezing/endSqueezing/simulateSqueeze methods, as well as squeezingStarted, squeezingClicked states?
The text was updated successfully, but these errors were encountered: