Add WebXRInterface.xr_standard_mapping flag to attempt to convert button/axis ids to match other AR/VR interfaces #59994
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.
The button and axis ids used by WebXR are different than other AR/VR interfaces, due in part to the fact that WebXR can handle input from a wider range of devices and input methods.
However, as discussed with @BastiaanOlij on Discord, it is possible to convert from WebXR's ids to the standard Godot ids in some cases, which is what this PR does.
The conversion will happen if
xr_standard_mapping
property onWebXRInterface
is set to true. It's set to false by default, for backward compatibility, however, I could be convinced to use the opposite default.In cases where we can't convert the ids, they are just passed through directly from WebXR. And, when we are converting, if there's more data than we know how to deal with, it's simply discarded.
Note: This PR is only against 3.x, similar to other recent WebXR PRs. Once it's possible to use WebXR on Godot 4.x, this functionality will be ported there.
Related to #59949