Skip to content

The webxr example is broken when enabling VR #2473

@AnthonyGlt

Description

@AnthonyGlt

Since the bump of the three.js version f7303de
The view_3d_map_webxr example doesn't work anymore when entering the VR mode

Screencast.from.04-12-2024.17.30.28.webm

Context

Steps to Reproduce

  1. Run the view_3d_map_webxr example
  2. Click on Enter VR
  3. Blank screen

Possible Cause/Fix/Solution

Since this merge in three.js, there is a condition on matrixWorldAutoUpdate .

To fix it, we should somehow set
view.scene.matrixWorldAutoUpdate = true;
either in the file view_3d_map_webxr.html
or in WebXR.js, using this kind of workaround
So in WebXR.js , above these lines

view.camera.camera3D.updateMatrix();
view.camera.camera3D.updateMatrixWorld(true);
view.notifyChange(view.camera.camera3D, true);

we could add

                const prevMatrixWorldAutoUpdate = view.scene.matrixWorldAutoUpdate;
                view.scene.matrixWorldAutoUpdate = true;
                view.scene.updateMatrix();
                view.scene.updateMatrixWorld();
                view.scene.matrixWorldAutoUpdate = prevMatrixWorldAutoUpdate;

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions