Aframe move vr-camera-component - PullRequest
       20

Aframe move vr-camera-component

0 голосов
/ 02 июля 2018

Я перемещаю камеру, когда запускаю событие, и она отлично работает на ПК, но не тогда, когда я нахожусь на моем телефоне в режиме vr. Нужно исправить вот этот код:

<a-entity id="camentity" rotation="0 90 0">
  <a-camera id="cam" user-height="0" wasd-controls-enabled="false" look-controls>
    <a-animation attribute="position" begin="movecam_1" duration="500" from="0 0 0" to="-40 0 -50"></a-animation>
    <a-animation attribute="position" begin="movecam_1_bc" duration="500" from="-40 0 -50" to="0 0 0"></a-animation>
 </a-camera>  
</a-entity>  

function kameramove_1() {
    document.querySelector( "#cam" ).emit('movecam_1');
    }

function kameramove_1_back() {
    document.querySelector( "#cam" ).emit('movecam_1_bc');
    }

1 Ответ

0 голосов
/ 02 июля 2018

Анимируйте камеру (родительский элемент камеры, цементность в вашем случае), а не сама камера:

    <a-entity id="camentity" rotation="0 90 0">
      <a-animation attribute="position" begin="movecam_1" duration="500" from="0 0 0" to="-40 0 -50"></a-animation>
      <a-animation attribute="position" begin="movecam_1_bc" duration="500" from="-40 0 -50" to="0 0 0"></a-animation>
      <a-camera id="cam"></a-camera>  
    </a-entity> 
...