WebXR examples not working

Hi @RaananW,

I’m trying to use the controls, but the examples of the tutorials are failing:

https://deployment--babylonjsdoc.netlify.app/how_to/webxr#webxrexperiencehelper

For example, in this PB it is braking at var xrInput = new BABYLON.WebXRInput(xrHelper); with the error:

Uncaught (in promise) TypeError: Cannot read property 'add' of undefined
    at new e (babylon.js:16)
    at createScene (<anonymous>:33:19)

I also tried the example locally and have the same error result.

Oh wow, how did you get this page? :confused:

This is a very old version of a very old page. Use the official doc:

https://doc.babylonjs.com/how_to/introduction_to_webxr

here in the how to:

the official URL of the doc is doc.babylonjs.com . you are using a deployment test we made, stored on netlify.

1 Like

ok thanks!

I saw a conference from you where you were grabbing some objects and they became bigger while you were pressing on then, Do you have that example at hand, or some example of interaction with meshes when you select then, In the hall controller tutorial there is no one example, so it is hard to put into practice.

https://doc.babylonjs.com/how_to/webxr_controllers_support#events-and-changes-of-a-controller-component

That I presented? Everything is possible :slight_smile:

Here, you can try this: Babylon.js Playground

It is using the bounding box gizmo to transform the mesh (translate, resize). Instructions are at the top of the code. You can also enable physics and have the meshes drop on you and stuff. Fun for an entire afternoon! :slight_smile:

Got on the forum to see if any good XR Demos… Went to the Babylon.js Playground one mentioned below. Loaded it on the Quest but got nothing but a loading spinner… Was thinking maybe it was throwing a Javascript error… So enabled developer mode and plugged into debug with Chrome device inspector tool… Reloaded and nothing in the console. Using the latest updates for everything. Looks like it’d be a fun demo though… I know this tech is still early but exciting to see where it goes :slight_smile:

Edit:

I checked on Desktop again and got… Didn’t get that the first time… So probably what’s happening on the Quest too… Maybe if I clear cache and try again later it’d work there too.

Access to XMLHttpRequest at 'https://snippet.babylonjs.com/RQM31Y/6' from origin 'https://playground.babylonjs.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
snippet.babylonjs.com/RQM31Y/6:1 Failed to load resource: net::ERR_FAILED

Must be a temporary error, as those two are very much related to one another (no playground will work without this CORS definition).

Can you try again? maybe any other playground just to check it is loading correctly?

Other playgrounds were working. Just checked and working on desktop Chrome. About to check in VR…

Hmm still not working if I clear cache and going to history to get it again… However if I go the forum and go the link directly it loads! Only different between the two is that one had some query string added, since posted it on FB to use as a shared clipboard lol. So makes no sense to me.

Facebook apparently makes our playground links not work. I think @Pryme8 had the same issue

Can you show me where you shared it? (If it’s public). I want to understand what happens there

In a message to someone. Don’t think I can copy and paste on the Quest… but if on my computer I go to m.facebook.com and open it It gives me this link:

https://playground.babylonjs.com/pg/RQM31Y/revision/6?fbclid=IwAR1RdcOW_y7vzSbK2coXaIEayPFjeqfUy1DhGAmuKT_EzRNNSyA3YOHaiEo

Not sure what that fbclid means but they add it to the links… Normal desktop Facebook doesn’t usually seem to do that…

Getting the spinning issue when using that. So might be something with passing in a query string or something with the playground then it seems.

great! Thanks a lot. I think I know what the issue is, and will take care of this.

Still they shouldn’t add query params to OUR URLs… But who listens @ Facebook :slight_smile:

2 Likes

Hi @RaananW,

So I tried the example, but is kind of complicated to use, and is not responding to the controller, only to the headset pointer. I just want to press the selection button and play a 360 video.
For example: eventData.type === BABYLON.PointerEventTypes.POINTERDOUBLETAP is related to hte mouse but I could make it work within the VR mode.

Dont you have like a list of different examples in WebVR where I can find the way to use it?

What I’m looking exaclty is to Select a mesh and start an action deppending of the mesh (like the example of the flag in WebVR).

What device are you using? Do you have both headset/gaze and a controller?

You can start a new thread for that if you want

1 Like