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

Add WebXRInterface.xr_standard_mapping flag to attempt to convert button/axis ids to match other AR/VR interfaces #59994

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Apr 7, 2022

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 on WebXRInterface 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

@dsnopek dsnopek force-pushed the webxr-standard-mapping branch 2 times, most recently from dd94ef7 to 69711ba Compare April 7, 2022 19:35
Copy link
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

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

This makes it a lot more portable to create a game that can move between platforms without having to worry about differences in button assignments, so great change!

…ton/axis ids to match other AR/VR interfaces
@dsnopek
Copy link
Contributor Author

dsnopek commented Apr 8, 2022

This should be ready now!

FYI, I removed the cherrypick:3.4 tag. It would probably be safe to port this to 3.4 (because backcompat is retained by default), but these changes touch some code that only exists in 3.x, and there really isn't a huge rush to get this out. I think it would be fine for this to come out in 3.5 with the other WebXR changes.

@akien-mga akien-mga merged commit 36dbcae into godotengine:3.x Apr 11, 2022
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants