This PR fixes this problem
Hi all
I am working on WebXR teleportation.
Everything worked fine until I add water to the scene. (“three/examples/jsm/objects/Water.js”)
This is how teleportation works
let cameraRig = new THREE.Group();
cameraRig.add(camera);
scene.add(cameraRig);
function teleport() {
cameraRig.position.add(new THREE.Vector3(10, 10, 10));
console.log(`camera.matrix : ${cameraRig.children[0].matrix.elements}`);
console.log(`camera.matrixWorld : ${cameraRig.children[0].matrixWorld.elements}`);
}
And this is what I get in console
camera.matrix : 1,0,0,0,0,1,0,0,0,0,1,0,10,11,10,1
camera.matrixWorld : 1,0,0,0,0,1,0,0,0,0,1,0,20,21,20,1
What I should get is
camera.matrix : 1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1
camera.matrixWorld : 1,0,0,0,0,1,0,0,0,0,1,0,10,11,10,1
Order to reproduce error
- Enter XR
- Press t to teleport and check console
- Press w to toggle water (remove/add)
- Press t to teleport and check console
I have tested it with
Win10 + Chrome + Webxr simulator plugin WebXR API Emulator - Chrome Web Store
Oculust Quest 2 + Oculus Browser
I have found a walk around but it feels unsafe. ( removing scene.add(cameraRig) )
I suspect Water’s onBeforeRender method.
Why does this thing happen? Will it be fixed?