是否可以在a帧中加载页面时设置默认的相机方向?

问题描述 投票:0回答:1

默认情况下,当我加载场景时,相机指向前方。但我希望它稍微指向上方。

我尝试使用rotation属性倾斜相机。首先,它可以工作。但是,当我将摄像机向后移动(到默认位置)并尝试向一侧移动时,摄像机将以奇怪的角度移动。如果我不通过摄像机旋转来加载场景,向上移动并再次向后移动,则不会像这样。

我正在Firefox的台式机上使用1.0.4版本的A形框架,用鼠标控制场景。

这是我的代码:

<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>

<a-scene>

  <a-entity id="rig" rotation="20 0 0">
    <a-entity camera look-controls="reverseMouseDrag: true" cursor="rayOrigin: mouse" position="0 1.6 0"></a-entity>
  </a-entity>

  <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
  <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E" shadow></a-sphere>
  <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D" shadow></a-cylinder>
  <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>
  <a-sky src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Equirectangular_projection_SW.jpg/1920px-Equirectangular_projection_SW.jpg"></a-sky>

</a-scene>
camera rotation aframe
1个回答
0
投票

改为考虑旋转a-sky或在所需的起始配置中设置对象场景。请注意,在VR中,您将无法强迫用户查看特定方向。

© www.soinside.com 2019 - 2024. All rights reserved.