【问题标题】:Aframe Camera Switch only works in non VR modeAframe 相机开关仅适用于非 VR 模式
【发布时间】:2019-02-17 09:33:34
【问题描述】:

现在正在研究项目,使用 Aframe 构建一些场景。如果用户进入一个门以进入下一个场景,我会尝试在我的 Aframe 场景中的不同相机之间切换。我有两个以下相机装备,每个场景一个:

<a-entity id="cameraRig" position="10 4 20">
<a-entity id="head" position="0 2 0" camera="" look-controls="pointerLockEnabled:true">
<a-cursor far="30"></a-cursor>
    <a-entity position="0.1 -0.4 0"
      raycaster="objects: .selectable; far: 2"
      teleport-extras
      teleport-controls=
        "cameraRig: #cameraRig;
        teleportOrigin: #head;
        startEvents:starttouch;
        endEvents:endtouch;
        curveShootingSpeed:30;
        hitCylinderRadius:0.3;
        collisionEntities: #tele">
    </a-entity>
 </a-entity>
</a-entity>

这是我更改相机的脚本:

function Hell() {
 document.getElementById('scene1').setAttribute('visible', 'false');
 document.getElementById('hell').setAttribute('visible', 'true');

 var standartCam = document.querySelector('#head');
 standartCam.setAttribute('camera', 'active', false);

 var hellCamera = document.querySelector('#head2');
 hellCamera.setAttribute('camera', 'active', true);
 }

在我进入 VR 模式之前,Switch 一直工作,然后相机根本不会切换。

我试图为第一个 CameraRig 设置一个新位置,但这会导致 Teleport 组件出现错误,即 Camera 会跳到它应该传送到的对象下方。

我怎样才能让它工作?感谢您的帮助。

【问题讨论】:

    标签: javascript html aframe webvr


    【解决方案1】:

    经过数小时的尝试和错误,我找到了解决方案。 我正在使用aframe.io/releases/0.8.0。 我切换到 0.7.0 并且它工作。 它也适用于 0.8.2。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-08
      • 2017-12-26
      • 2018-08-28
      • 1970-01-01
      • 1970-01-01
      • 2019-10-06
      相关资源
      最近更新 更多