首页 > 解决方案 > 如何更改每个实体内的 A 帧相机旋转?

问题描述

我很难在我的项目中更改相机旋转。

https://glitch.com/~camera-experiment

每次用户移动到新的“区域”时,我都需要相机旋转以面向不同的方向。这些区域只是具有不同的背景图像。

理想情况下,我只想旋转每个实体的背景图像,但我也不能这样做。

有没有人有任何建议?任何帮助将不胜感激!

标签: aframevirtual-reality

解决方案


使用相机装备/包装实体并更改其旋转。aframe - 在运行时设置相机位置

<a-entity id='cameraRig'>
  <a-camera></a-camera>
</a-entity>

document.querySelector("#cameraRig").object3D.rotation.set(x, y, z);  // Radians. Can use setAttribute for degrees or convert manually.

推荐阅读