2017-02-03 26 views
0

項目:基本網站,顯示與谷歌的VRView Web全景圖像和添加熱點。谷歌VRView for Web - 添加熱點

問題:全景圖顯示正常,未能添加熱點,文檔很差+谷歌搜索導致約略有結果。 1.5小時。

代碼:

<script type="text/javascript"> 

window.addEventListener('load', onVrViewLoad) 
function onVrViewLoad() { 
    var vrView = new VRView.Player('#vrview', { 
    image: 'uploads/pano.jpg', 
    is_stereo: false 
    }); 

    vrView.addHotspot('hotspot-one', { 
     pitch: 30, // In degrees. Up is positive. 
      yaw: 20, // In degrees. To the right is positive. 
      radius: 0.05, // Radius of the circular target in meters. 
      distance: 2, // Distance of target from camera in meters. 
    }); 
} 

</script> 

<div id="vrview"> 
</div> 

請求:有沒有人能實現這些熱點?我也嘗試添加點擊按鈕,無濟於事。在一個laravel服務器和一個基本的html實現中都試過,但沒有用。

支持文檔/例子:

回答

5

必須添加代碼插入準備

<script type="text/javascript"> 
 

 
window.addEventListener('load', onVrViewLoad) 
 
function onVrViewLoad() { 
 
    var vrView = new VRView.Player('#vrview', { 
 
    image: 'uploads/pano.jpg', 
 
    is_stereo: false 
 
    }); 
 
vrView.on('ready',function(){ 
 
    vrView.addHotspot('hotspot-one', { 
 
     pitch: 30, // In degrees. Up is positive. 
 
      yaw: 20, // In degrees. To the right is positive. 
 
      radius: 0.05, // Radius of the circular target in meters. 
 
      distance: 2, // Distance of target from camera in meters. 
 
    }); 
 
} 
 
}); 
 

 
</script> 
 

 
<div id="vrview"> 
 
</div>

+1

這是我認爲的正確答案 – FabioC

+0

是的,這對我也有效! +1 – stursby

+0

兄弟能否請你幫我 https://stackoverflow.com/questions/49166181/control-button-on-google-vr-view –