我试图通过aframe平台播放360视频时观察观看者的方向。输出可以是FOV的中点值(视野)...有谁知道怎么做?请帮帮我!!
答案 0 :(得分:0)
如果您从A-Frame主页开始使用全景示例,您可以像这样更改它以获得角度:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Panorama</title>
<meta name="description" content="Panorama — A-Frame">
<script src='//cdnjs.cloudflare.com/ajax/libs/aframe/0.5.0/aframe.js'></script>
<script>
AFRAME.registerComponent('theta', {
tick: function (time, timeDelta) {
var camera = this.el.object3D.children[0]
vector = camera.getWorldDirection();
theta = Math.atan2(vector.x,vector.z);
console.log(theta);
},
});
</script>
</head>
<body>
<a-scene>
<a-camera theta></a-camera>
<a-sky src="puydesancy.jpg" rotation="0 -130 0"></a-sky>
</a-scene>
</body>
</html>
(通过Three.js: Get the Direction in which the Camera is Looking)