Search code examples
aframe

Is there a way to know the "real" position of an a-frame element?


I want to find the "real" position of an a-frame element. Not the one shown in the position attribute. But the one that's the total of all the parents and relative to the world/scene position?


Solution

  • You can look up world coordinates in three.js: https://threejs.org/docs/#api/en/core/Object3D.getWorldPosition

    It looks something like:

    var worldPos = new THREE.Vector3();
    worldPos.setFromMatrixPosition(el.object3D.matrixWorld);