我试图像这样在Aframe中制作rolodex菜单。
这是到目前为止https://glitch.com/edit/#!/fourth-kitten的故障
我试图让实体旋转到相机视图
AFRAME.registerComponent('rotate-with-camera', {
tick: function (){
console.log(this)
if(this.el.sceneEl.camera){
const {rotation} = this.el.sceneEl.camera.parent
const containerRotation = this.el.getAttribute('rotation')
this.el.setAttribute('rotation', {...containerRotation, z: containerRotation.y -= rotation._y * 360})
}
}
})
然而,我不能像这个例子那样得到一个很好的平滑滚动,我很困惑,正确的数学让它停留在相机前面卷起或滚动下来使下一行动画进入视图。
有任何想法吗?
如果要将它放在摄像机前面,那么只需使用父子DOM层次结构:
<a-camera>
<a-entity position="0 0 -3></a-entity>
</a-camera>
这样,您的菜单将位于相机前方,并随相机一起旋转。
要访问外部元素,您可以在相机向右 - 左看时移动容器
小故障here。