-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 WebXR demo #1168
base: master
Are you sure you want to change the base?
Add WebXR demo #1168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The demo itself looks great! I tested in the Meta WebXR emulator in Chrome, and in the Meta Quest browser on a Quest 3, and everything worked great. I only have a handful of nitpicky comments on the code.
The main thing I'm worried about, though, is that this doesn't include the polyfills, because it doesn't have the export_presets.cfg
, which means this won't work on all browsers (most significantly on Firefox). This isn't ideal, especially because this will get exported and uploaded for folks to try, and may lead to confusion around whether certain browsers are supported or not.
I'm not sure how to handle this, though, because we already have the standard of not including export_presets.cfg
with any of the demo projects
cc @Calinou
# This list means it'll first try to request 'bounded-floor', then | ||
# fallback on 'local-floor' and ultimately 'local', if nothing else is | ||
# supported. | ||
webxr_interface.requested_reference_space_types = 'bounded-floor, local-floor, local' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the number of people that have copy-pasted this code wholesale over the years, I've been regretting including 'bounded-floor'
in here. It's a good example to show both optional and required features, but I suspect most developers would actually have a better experience with 'local-floor'
.
But I'm not entirely sure we should change this, and if we do, it should be changed in the WebXRInterface
docs too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would just keep the configuration as is for this demo (because as you say it's a good example of optional and required features), but we could modify the comments or add to them, here and/or in the WebXRInterface documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes sense! The descriptions of the reference spaces in the comment also aren't that great.
I'll take a stab at rewriting the comment, but we don't really need to fix this here and now - we can iterate on it elsewhere
In the latest push I added a special case for the WebXR demo export preset, to add the polyfills using |
Based on https://docs.godotengine.org/en/stable/classes/class_webxrinterface.html and https://www.snopekgames.com/tutorial/2023/how-make-vr-game-webxr-godot-4 Co-Authored-By: David Snopek <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
In the latest push I added a special case for the WebXR demo export preset, to add the polyfills using
sed
.
This solves one problem: the public upload of the demos will work on all the browsers it can.
However, if someone starts their WebXR project by copy-pasting the demo, they won't have the polyfills, which isn't ideal.
I don't necessarily think this should hold up getting a demo in there at all, though! We could continue to figure out how to improve this in a follow-up
# This list means it'll first try to request 'bounded-floor', then | ||
# fallback on 'local-floor' and ultimately 'local', if nothing else is | ||
# supported. | ||
webxr_interface.requested_reference_space_types = 'bounded-floor, local-floor, local' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes sense! The descriptions of the reference spaces in the comment also aren't that great.
I'll take a stab at rewriting the comment, but we don't really need to fix this here and now - we can iterate on it elsewhere
# 'bounded-floor' is room scale, 'local-floor' is a standing or sitting | ||
# experience (it puts you 1.6m above the ground if you have 3DoF headset), | ||
# whereas as 'local' puts you down at the XROrigin3D. | ||
# This list means it'll first try to request 'bounded-floor', then | ||
# fallback on 'local-floor' and ultimately 'local', if nothing else is | ||
# supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A first pass at rewriting this, but I'm not super happy with it:
# 'bounded-floor' is room scale, 'local-floor' is a standing or sitting | |
# experience (it puts you 1.6m above the ground if you have 3DoF headset), | |
# whereas as 'local' puts you down at the XROrigin3D. | |
# This list means it'll first try to request 'bounded-floor', then | |
# fallback on 'local-floor' and ultimately 'local', if nothing else is | |
# supported. | |
# The reference space affects what the XROrigin3D position represents, and | |
# consequently what the positions of the XRCamera3D and XRController3D | |
# nodes are relative to: | |
# - 'bounded-floor' is for room-scale, where the XROrigin3D will be positioned | |
# in the center of your play space | |
# - 'local-floor' is for most standing or sitting experiences, where you want the | |
# XROrigin3D to positioned at your real world floor, but the X and Z position | |
# will start where you were standing when entering XR | |
# - 'local' puts the XROrigin3D where your head was when entering XR, and is | |
# best suited for experiences that don't have any relation to the real world floor | |
# like driving or flight simulators, or where the character you embody is of a different | |
# height than the real player | |
# This list means it'll first try to request 'bounded-floor', then fallback on 'local-floor' | |
# and ultimately 'local', if nothing else is supported. |
... or, maybe the whole list of reference spaces should be removed, and we should just have the last part "This list means it'll first try..." and have a link to some other documentation where we describe them individually?
Minimalistic demo based on https://docs.godotengine.org/en/stable/classes/class_webxrinterface.html and https://www.snopekgames.com/tutorial/2023/how-make-vr-game-webxr-godot-4
cc @dsnopek