WebXR project setup troubles

Godot Version

4.0.1 and 4.4.1, Windows 11

Question

I’m trying to set up a simple WebXR project to prototype some interactions.

Following Malcolm Nixon’s tutorial with 4.4.1, the project works on my PC-linked Quest 3, but not properly as WebXR. Neither of the controllers work, and the player starts off a few meters away from where it’s actually positioned, looking into the wrong direction, too. Since the controllers don’t work, I can’t even correct the position and orientation.

Recreating the video’s setup using the same version 4.0.1 (incl. v4.0 of the XR Tools), it does work in WebXR, but movements don’t work on the linked Quest (when running the project F5). Unfortunately testing via the built-in http server is too slow to be practical, so I do need it to work on the linked Quest for iterations, and only export occasionally to WebXR.

I’ve also been referring other tutorials (for instance, How to make a VR game for WebXR with Godot 4 | Snopek Games), but there always seems to be something not working, incl. heavy flickering in the left eye of the headset (while the controllers also don’t work), and initializing into an endless fall with the plane collision seemingly being ignored (I can look up and see those other blocks).

I would like to have quick turnarounds with a linked Quest and then be able to reliably export results to WebXR to share with the client.

(New user and new in the forum, please excuse and let me know any mistakes I’m making.)

Hello!

What web browser are you using? If you’re using a desktop browser and streaming to the headset, which streaming technology are you using (Quest Link, Virtual Desktop, etc)? Are you using the polyfills recommended in this tutorial?

The issue with the left eye flickering could be this issue with having glow enabled:

If so, then disabling glow in the world environment should fix it.

A few other folks have had an issue with the controllers not working in the past, although, I’ve never been able to reproduce it myself, and in most cases it stopped happening after a while. If you have a reliable way to reproduce it, that would be amazing! That could help in debugging what’s causing it

I can’t think of any reason why collision detection wouldn’t work in WebXR. Other than rendering and input, your game should work just like any Godot web export. Could it be that you’re spawning in an unexpected place, and it’s missing collision? If so, check if you’re using the “bounded-floor” reference space, and try switching to using “local-floor” instead - that should spawn you right where the XROrigin3D node is placed

Hopefully some of that helps!

Hi! Thanks for responding.

  • I’m using Quest 3’s built-in Browser.
    • (When “streaming” / testing the build directly, I’m using Meta’s stock Quest Link, started from the Godot Editor “Run”. This and the APK build both work.)
    • I’m also testing with Chrome / Edge + Meta’s Immersive Web Emulator on Windows to get debug output (see below).
  • I am using the polyfills in your tutorial :+1:
  • Glow was / is not enabled. For a second, I hoped it was the issue / solution :sweat_smile:

I checked the current web build just now – it no longer has me falling through, nor does the left eye flicker (dunno which change “fixed” it). However the stick control still doesn’t work, nor do some other handtracking based interactions that work in the APK build. Only the basic tracking of the head and controllers seem to function.

The controller (and the collision previously) not working seem to be a downstream problem, caused by some other initial / basic viewport code running into errors (thanks to the dev output via Chrome / Meta’s immersive web emulator).

Each of these repeat countless times, and the browser tab freezes a few seconds after entering VR.

WebGL: INVALID_OPERATION: texParameter: no texture bound to target
 ERROR: The axis Vector3 (0.0, 0.0, 0.0) must be normalized.
onPrintError @ index.js:474
    at: set_axis_angle (core/math/basis.cpp:857)

callUserCallback @ index.js:9
runIter @ index.js:9
Browser_mainLoop_runner @ index.js:9
onFrame @ index.js:9
injectedFrameCallback.injectedFrameCallback @ webxr-layers-polyfill.min.js:204
XRSession$1.<computed>.onDeviceFrame @ webxr-polyfill.js:3166
index.js:474    at: set_axis_angle (core/math/basis.cpp:857)

The build is available at vr_ui_proto_441 if that’s usable for debugging? I’m getting 100% repro.

Happy to provide additional information or try other things.

When I try your app in desktop Chrome on Linux with Meta’s WebXR emulator, I also get the “The axis Vector3 (0.0, 0.0, 0.0) must be normalized” message repeatedly. However, I don’t get the WebGL one, and the app otherwise seems to work: I can move the headset and the controllers around just fine, and it’s still working minutes later. It would be nice to figure out the “axis must be normalized” message, but that error doesn’t seem to be fatal.

For the WebGL error: Is it possible that multiview rendering is unsupported? Visit this page, and see if you have “OVR_multiview2” listed under supported extensions. I would be surprised if this was the case, though, if Godot works fine over Quest Link.

These could be XR Tools issues.

The joystick works differently in WebXR than in OpenXR, and XR Tools has a system that’s supposed to unify them, but some folks have had problems with it, for example:

You may need to do something to get the user settings stuff to take effect. It’s been awhile since I used it, but I think it depends on adding a special autoload? It would be worth looking at the XR Tools demo, or perhaps just accessing the WebXR joystick directly to see if the data is there.

And for hand tracking, I’m not exactly sure what isn’t working, since I haven’t tried the APK version, but it looks like it’s not doing full hand-tracking and just interpreting a pinch gesture. I assume you want it to be doing full hand tracking? I just tried a small test project I have for WebXR hand tracking and full hand tracking is working fine for me with Godot 4.4.1.

Can you check if XR Tools is adding the "hand-tracking" feature to WebXRInterface.optional_features as it is supposed to here:

I’m not as familiar with all the stuff that XR Tools does for hand tracking, so there may be something else going wrong, but that’s the first thing to double check :slight_smile:

According to the linked page, OVR_multiview2 is supported both on my Windows Chrome/Edge and the Quest Browser.

I tried changing primary to thumbstick but it didn’t help, unfortunately. Do the stick controls work for you?

That hand-tracking line is like you showed, as I didn’t touch it in the first place.

It’s interesting you don’t think the vector error is fatal. To me it does seems like some code gets stuck at those errors, and so the build runs incompletely at best. In other words, it doesn’t seem like it’s the incorrect access of the stick or hand-tracking that causes those features to not work for themselves (unless that incorrect access causes the errors), but like something else is breaking the overall thing.

Running the build via the http server gets me the error messages in the Godot Editor with slightly more details that I can expan. Maybe this is somewhat useful?


I’ll try to see what I can understand/learn from the demo project.

When opening the demo (Godot XR Tools Demo - Godot Asset Library is the one you’re talking about, right?), it needed to be converted to 4.4 which I confirmed.

After that, “Run Project” works via Quest Link, but Remote Deploy, Run in Browser results in the same errors. So, the same situation as with my own project (which really just followed the tutorials for the fundamental setup).

Not in your app, no. But when using WebXR directly (ie without XR Tools) I’m able to access the thumbstick data.

I don’t recall exactly how the XR Tools stuff is supposed make WebXR thumbsticks work, I haven’t used it in some time.

Right, I meant to check if that line is working. Like, adding a print() statement there and seeing if it’s actually adding "hand-tracking" or not

Hm, it’s unfortunate that the XR Tools demo isn’t working either. :-/ I still suspect the thumbstick and hand tracking issues could be in XR Tools somewhere (perhaps the XR Tools support for WebXR broke at some point?) since I don’t personally have any trouble when working with WebXR directly

I see. Yep just did and the print() confirms that if case.

That’s my suspicion…

I guess – if you have any more time to waste on this issue – it would be interesting to see if it works for you (or anyone, for that matter) using the steps in your tutorial but in a Godot 4.4.1 + XR Tools 4.4 setup.

I don’t know what else I could try to troubleshoot or isolate the issue, nor if my case justifies an issue on github.