2017-03-04 88 views
0

我試圖通過aframe平臺播放360視頻時觀看觀看者的觀看方向。輸出可以是FOV(視場)的中點值...有誰知道如何去做吧?請幫幫我!!查看觀看方向的時間

回答

0

如果你從A字架主頁全景例如開始時,你可以改變它像這樣獲得的角度:

<!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