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

OpenXR fix character centric recenter code #1131

Merged
merged 5 commits into from
Nov 15, 2024

Conversation

BastiaanOlij
Copy link
Contributor

@BastiaanOlij BastiaanOlij commented Nov 13, 2024

This fixes the recenter code to work with different reference spaces.

While these changes also apply to Godot 4.3, not all XR runtimes properly trigger the recenter signal. For this to consistently work godotengine/godot#99159 is required.

if play_area_mode == XRInterface.XR_PLAY_AREA_SITTING:
push_warning("Sitting play space is not suitable for this setup.")
elif play_area_mode == XRInterface.XR_PLAY_AREA_ROOMSCALE:
# This is already handled by the headset.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note, this else if is purely here for documentation purposes so that anyone reading this code knows, the headset already applies the required logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a good idea to me!

@BastiaanOlij
Copy link
Contributor Author

One thing we may wish to add to this demo is setting the project settings to LOCAL_FLOOR space as the default recommended reference space.

cc @dsnopek

@BastiaanOlij BastiaanOlij force-pushed the openxr_fix_recenter_logic branch from f260fee to bdd3bef Compare November 13, 2024 03:27
@dsnopek
Copy link
Contributor

dsnopek commented Nov 13, 2024

I tested on Quest 3 with Godot master (which includes godotengine/godot#99159) and it worked great for me!

One thing we may wish to add to this demo is setting the project settings to LOCAL_FLOOR space as the default recommended reference space.

I would be in favor of this! I think LOCAL_FLOOR is a good default for most projects.

@BastiaanOlij
Copy link
Contributor Author

Note to production team. While this PR does require a fix to fully work, we should contemplate merging it already as it does improve the demo and it ensure people don't copy code into their project that will not work correctly once the Godot releases with the fix.
However fully understand if we hold off until 4.4 is release and/or the fix is cherry picked for 4.3

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

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

If it's not completely broken in 4.3 then we can merge this, as long as the code samples are updated to follow the GDScript style guide.

xr/openxr_character_centric_movement/player.gd Outdated Show resolved Hide resolved
xr/openxr_character_centric_movement/player.gd Outdated Show resolved Hide resolved
xr/openxr_character_centric_movement/player.gd Outdated Show resolved Hide resolved
xr/openxr_character_centric_movement/player.gd Outdated Show resolved Hide resolved
@dsnopek
Copy link
Contributor

dsnopek commented Nov 14, 2024

Note to production team. While this PR does require a fix to fully work, we should contemplate merging it already as it does improve the demo and it ensure people don't copy code into their project that will not work correctly once the Godot releases with the fix.

I personally think this is fine to merge now. I don't think the code in this PR is really broken in 4.3; it's just that there's an additional bug in 4.3 that prevents it from fully working. I think the code from before the PR also suffers from the same issue.

Tying this back to something else discussed above: if we also updated this demo to use the "Local Floor" reference space, then re-centering would work out-of-the-box - it'd only be the example code showing how to recent when using the "Stage" reference space that wouldn't work.

Calinou and others added 4 commits November 15, 2024 19:00
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
@Calinou Calinou merged commit 6db1062 into godotengine:master Nov 15, 2024
1 check passed
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