aframe icon indicating copy to clipboard operation
aframe copied to clipboard

World position workaround for VR not working

Open finnlock opened this issue 4 years ago • 3 comments

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

finnlock avatar Mar 18 '22 20:03 finnlock

Can you provide runnable example to reproduce? I recommend https://glitch.com/edit/#!/aframe

dmarcos avatar Mar 21 '22 12:03 dmarcos

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

dmarcos avatar Mar 21 '22 16:03 dmarcos

I also recommend using A-Frame 1.3.0

dmarcos avatar Mar 21 '22 16:03 dmarcos