aframe
aframe copied to clipboard
World position workaround for VR not working
Description: I understand that getWorld* functions don't work in VR, and that a workaround was mentioned, but I still cannot seem to get it to work.
- A-Frame Version: 1.2.0
- Platform / Device: Oculus Quest 2
- Reproducible Code Snippet or URL:
let worldPosition = new THREE.Vector3();
const camera = document.querySelector("#camera");
camera.object3D.updateMatrixWorld();
camera.sceneEl?.object3D.updateMatrixWorld();
worldPosition.setFromMatrixPosition(camera.object3D.matrixWorld);
console.log(worldPosition); // Always returns (0, 0, 0) in Oculus Quest 2 VR
Can you provide runnable example to reproduce? I recommend https://glitch.com/edit/#!/aframe
An example printing the world position https://glitch.com/edit/#!/momentous-foremost-game?path=world-position.js%3A7%3A0
As far as I can tell A-Frame works as expected. For usage questions I recommend using https://stackoverflow.com/questions/tagged/aframe
I'm closing this and can reopen if necessary. Best of luck
I also recommend using A-Frame 1.3.0