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

Example/best practice for select events and selectComponentId? #160

Open
klausw opened this issue Jan 28, 2020 · 4 comments
Open

Example/best practice for select events and selectComponentId? #160

klausw opened this issue Jan 28, 2020 · 4 comments
Labels
motion-controller motion-controller package
Milestone

Comments

@klausw
Copy link

klausw commented Jan 28, 2020

Applications that want to work across a variety of devices likely want to handle XR select events, while also supporting additional inputs where available. To avoid duplicate events or colliding function assignments, it's important to know which gamepad information corresponds to the select event, and if I'm understanding it right, the selectComponentId attribute as described in https://immersive-web.github.io/webxr-input-profiles/packages/registry/#components is intended to provide this information.

However, what's the best way for applications to do this when using the MotionController library? I couldn't find code using the selectComponentId attribute for this in the library or example snippets.

For an xr-standard mapping, the primary trigger would correspond to the "select" component, but applications shouldn't necessarily assume that the select event is a trigger if they want maximum cross-device portability.

Would it be feasible to add an example and/or a helper method to encourage applications to handle this in a compatible way?

@klausw klausw added the motion-controller motion-controller package label Jan 28, 2020
@klausw
Copy link
Author

klausw commented Jan 28, 2020

Alternatively, if this is out of scope, could the library return a result in createMotionController indicating that this input source's device profile isn't a supported motion controller and should be handled in a different way?

@toji toji added this to the Future milestone Feb 3, 2020
@klausw
Copy link
Author

klausw commented Feb 6, 2020

For example, input sources such as screen touch on a handheld AR device, or an untracked "clicker" button such as the Cardboard trigger, would generally provide XR select events and/or XR input sources, but shouldn't be rendered as 3D controller models. In such a case, I think it would be helpful if the library would help distinguish this. If it's already possible, it would help to have an example or best practice documentation.

@ManuelGraf
Copy link

well, a clicker or hardware button is not exactly a motion controller!
But yeah would be nice to have the possibility of adding an agnostic interface for like cardboard button, maybe even regular gamepads and the likes.
But In general I agree that callbacks/documentation for any of the events would be nice. Right now i am emitting such events manually...

checkTriggerInput(controller: VrInputController, trigger) { if (trigger.values.state === Constants.ComponentState.PRESSED) { if (!controller.triggerPressed) { controller.triggerPressed = true; this.onTriggerPressed(controller); } } if (trigger.values.state === Constants.ComponentState.DEFAULT) { if (controller.triggerPressed) { this.onTriggerReleased(controller); controller.triggerPressed = false; } } if (trigger.values.state === Constants.ComponentState.TOUCHED) { this.onTriggerTouched(controller); } }

@michaelybecker
Copy link

thanks @ManuelGraf - literally the only example I could find online of XR gamepad event callback handling... we could really use more documentation on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
motion-controller motion-controller package
Projects
None yet
Development

No branches or pull requests

4 participants