Skip to content

feat(XR): Enable translation with WebXR gamepad API #2184

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 3, 2022

Conversation

tbirdso
Copy link
Contributor

@tbirdso tbirdso commented Dec 1, 2021

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Context

In moving from WebVR to WebXR we must also integrate changes from the updated WebXR gamepad API. VR controllers are exposed solely under the xr-standard extension to the Gamepad API which remaps buttons/axes and exposes controller transforms as XRPose objects.

Changes

  • updateXRGamepads is updated to reflect WebXR gamepads where controllers are identified by handedness rather than ID or index (see https://www.w3.org/TR/webxr-gamepads-module-1/#gamepad-differences).
  • VR locomotion in InteractorStyleTrackballCamera is revised from variable-speed translation based on the touchpad direction to fixed-speed translation in the direction of the right-handed controller. The WebXR Gamepad API requires that VR gamepads report a trigger button, while the touchpad/thumbstick is not guaranteed. Locomotion can be triggered with either a trigger press or (if available) a touchpad press.

Results

  • VR locomotion is re-introduced to OpenGL/RenderWindow and the Geometry/VR example so that the user may "fly" around their dataset. Locomotion is technically present in the Applications/SkyboxViewer example as well, but is not visible to the user as that example consist of just a skybox.

Testing

  • All tests complete without errors on the following environment:
    • vtk.js: v21.1.4
    • OS: Windows 10
    • Browser: Chrome 96.0.4664.45

@tbirdso tbirdso requested review from floryst and martinken December 1, 2021 18:42
Copy link
Member

@martinken martinken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@tbirdso tbirdso marked this pull request as ready for review December 6, 2021 15:48
@tbirdso tbirdso mentioned this pull request Dec 13, 2021
5 tasks
@floryst
Copy link
Collaborator

floryst commented Jan 3, 2022

LGTM

@tbirdso tbirdso merged commit a663af5 into Kitware:master Jan 3, 2022
@github-actions
Copy link

github-actions bot commented Jan 3, 2022

🎉 This PR is included in version 21.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label Jan 3, 2022
@tbirdso tbirdso deleted the webxr-gamepad branch February 26, 2023 23:55
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
released Automated label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants