aframeoculuswebxroculusquest

Can't move camera in A-Frame with Oculus Quest 2


Is it possible to move camera in A-Frame projects with Oculus touch controllers?

Can't find any working example.


Solution

  • You can try and re-use existing components. wasd-controls are working well for movement, so You can write a similar component utilizing the thumbstick input instead of the wasd keys.


    You can try out my barbaric attempt here(docs).
    It's quite simple - create a rig for the controllers + camera and attach oculus-thumbstick-controls to any controller:

    <script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
    <script src="https://gftruj.github.io/webzamples/aframe/controls/oculus-thumbstick-controls.js"></script>
    <a-scene>
      <!-- Camera + controllers rig -->
      <a-entity id="rig">
        <a-camera position="0 1.6 0"></a-camera>
        <a-entity oculus-touch-controls="hand: left" ></a-entity>
        <a-entity oculus-touch-controls="hand: right" oculus-thumbstick-controls></a-entity>
      </a-entity>
    </a-scene>