WebXR not working

Hey, Im using a Oculus Quest and wanna try out VR. I downloaded the latest version of Threejs r112 and took the webxr_vr_dragging.html example (for playing around) and uploaded it to my own server.

If I visit the example on threejs.org, it is working, but not when I visit it on my domain (with oculus).
Also when visiting threejs.org example via PC the VRButton says: “VR NOT SUPPORTED”, but on my own domain saying: “WEBXR NEEDS HTTPS”?

What am I missing? I basicly took the example and changed the necessary paths to threejs. Nothing more.

I just Debugged my oculus quest, the error is:

Cannot set property ‘enabled’ of undefined

pointing at renderer.xr.enabled = true;

Are you serving your content via HTTPS? If not, well, then we have found the root cause.

1 Like

I am having the same issue. It seems there is something wrong with the WebXRManager because everything calling .xr is saying

Cannot set property ‘enabled’ of undefined

WebXRManager is accessible under WebGLRenderer.xr.

const renderer = new THREE.WebGLRenderer()
renderer.xr.enabled = true

Also, ensure you are working in a secure context when working with WebXR sessions. See: starting and shutting down a WebXR session by Mozilla.

If you want a quick dev environment to work in, I’d recommend Codesandbox.

1 Like

The issue is that

const renderer = new THREE.WebGLRenderer()
renderer.xr.enabled = true
gives the error
Uncaught TypeError: Cannot set property ‘enabled’ of undefined
could the issue be that I am using chrome?

What version of three.js are you using?

the three.js file I reference was downloaded just the other day

Now when I try to run the exact same file as the webxr_vr_dragging.html example, I get the exact same error

Can you try to make a demo in jsFiddle or Codepen?