2017-10-12 63 views
2
<!DOCTYPE html> 
<html> 
<head> 
    <title>Forest</title> 
<script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script> 
<script src="https://rawgit.com/feiss/aframe-environment-component/master/dist/aframe-environment-component.min.js"></script> 
</head> 
<body> 
<a-scene> 
    <a-assets> 
    <a-asset-item id="brainstem" src="https://cdn.aframe.io/test-models/models/brainstem/BrainStem.gltf"></a-asset-item> 
    </a-assets> 

    <a-entity environment="preset: forest; groundColor: green; grid: cross"></a-entity> 
    <a-entity gltf-model="#brainstem" position="0 0 -5" scale="3 3 3"></a-entity> 
    <a-box position="-2 0.5 -17" rotation="0 0 0" color="#4CC3D9" width="10"></a-box> 
    <a-box position="-2 0.5 -10" rotation="0 0 0" color="#4CC3D9" width="10"></a-box> 
    <a-box position="-2 0.5 -3" rotation="0 0 0" color="#4CC3D9" width="10"></a-box> 
    <a-box position="10 0.5 -8" rotation="0 90 0" color="brown" width="1.5" height="0.5"></a-box> 

    <a-sky color="black"></a-sky> 
</a-scene> 
</body> 
</html> 

我正在使用a-frame構建上述模型......當我在智能手機上運行它時,移動設備,它會檢測到旋轉運動,但在我向前或向後移動時不會響應...我沒有完整的VR設置(我有VR耳機)...是否有任何解決方案來檢測移動使用只有耳機。如何在僅使用耳機而不是控制器的webvr中進行移動,使用「Aframe」製作

回答

3

當前手機無法檢測位置移動(6DoF),只能旋轉(3DoF)。沒有好的解決方法,GPS定位幾乎不夠精確。對於移動VR場景,您應該考慮其他移動方式,例如傳送到檢查點或推動紙板按鈕向前移動。在aframe-extras中有兩個例子。

+0

在控制器的幫助下,運動是否可能?我需要添加任何其他代碼以使控制器工作...? –

+0

請參閱文檔和示例鏈接到aframe-extras。它支持遊戲手柄,但是你需要額外的組件來實現[跟蹤控制器的傳送](https://github.com/fernandojsg/aframe-teleport-controls) –

相關問題