feat(XR): Enable translation with WebXR gamepad API #2184
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR and Code Checklist
npm run reformat
to have correctly formatted codeContext
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).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
OpenGL/RenderWindow
and theGeometry/VR
example so that the user may "fly" around their dataset. Locomotion is technically present in theApplications/SkyboxViewer
example as well, but is not visible to the user as that example consist of just a skybox.Testing