Aframe A帧中是否可能有多个活动摄影机?

Aframe A帧中是否可能有多个活动摄影机?,aframe,Aframe,我想有两个单独的相机在A帧,这两个都是并排显示在屏幕上,在同一时间。是否可能?您可以将“其他摄影机”视图的渲染绘制到画布元素。 假设您有两个摄像头的设置: <!–– The canvas in which we will render the secondary camera --> <canvas width="256" heigth="256"></canvas> <a-scene foo> <!

我想有两个单独的相机在A帧,这两个都是并排显示在屏幕上,在同一时间。是否可能?

您可以将“其他摄影机”视图的渲染绘制到画布元素。 假设您有两个摄像头的设置:

<!–– The canvas in which we will render the secondary camera -->
<canvas width="256" heigth="256"></canvas>

<a-scene foo>
<!–– Main camera with a sphere to see the movement from the other cam -->
<a-camera><a-sphere scale="0.1 0.1 0.1"></a-sphere></a-camera>
  
<!–– the secondary camera positioned somewhere -->
<a-entity position="4 1.6 -4" rotation="0 90 0">
  <a-entity id="secondarycam" camera="active: false"></a-entity>
</a-entity>
</a-scene>

故障示例

能否详细说明“A-Frame”的含义?它是一个用于创建WebXR体验的框架。是的。这就是我要找的。但我希望第二台摄像机在进入AR或VR模式时仍然可见。然后,您可以将另一台摄像机画布用作纹理:我尝试过这样做,但当我进入AR时,纹理会更改为我房间的实时摄像机输出。
AFRAME.registerComponent("foo", {
  init: function() {
    // grab the canvas
    var canvas = document.querySelector("#cam");
    this.ctx = canvas.getContext("2d");
    // grab the secondary camera (the THREEjs cam within the camera component)
    this.secondaryCam = document.querySelector("#secondarycam").components.camera.camera;
    },
    tick: function() {
      // wait until init is done
      if (!this.secondaryCam) return;
      // render the secondary camera view
      this.el.renderer.render(this.el.sceneEl.object3D, this.secondaryCam);
      // draw the render on the canvas
      this.ctx.drawImage(this.el.renderer.domElement, 0, 0, 256, 256);
    }
  });