I would like to get the positions of the two (or more) cameras used for rendering 3D via WebXR. I tried this snippet of code, but I always get zero cameras in the array:
const s = this.renderer.xr.getCamera(camera) as THREE.ArrayCamera;
if (s && s.isArrayCamera) {
if (!this.cameras || this.cameras.cameras.length < s.cameras.length) {
this.cameras = s;
Debug.log(`Camera count: ${this.cameras.cameras.length}`)
for (const c of this.cameras.cameras) {
Debug.log(`X: ${c.position.x}`);
}
}
}
My end goal here is to make something like the portal demo work in WebXR.
Thank you!