MozillaReality / WebXR-emulator-extension

WebXR emulator extension
Mozilla Public License 2.0
454 stars 55 forks source link

Raycast works right in browser, but doesn’t works when enter to the WebXR mode #293

Open foxfairlane opened 1 year ago

foxfairlane commented 1 year ago

When you enter in the VR Mode, the raycast from mouse cursor has a big offset. If you try in a mobile phone WebXR, the offset is different and bigger.

You can check it out in this simple jsfiddle https://jsfiddle.net/foxfairlane/d3t7khvu/4/

Do click several times and different positions on the screen and you will see how the ray is just under your mouse cursor position. It's working right.

Now you press the "Enter VR" button to enter in VR mode and try to do the same. You will see how the ray is offset from your mouse cursor position. It's not working right.

I already changed the camera to renderer.xr.getCamera(), for function raycaster.setFromCamera(mouse, camera)

What is going on?? How I could fix this problem???