2

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

Can't find any working example.

  • 1
    If you share complete simple code illustrating your attempt and it will be much easier to help you. glitch.com/~aframe is great for people to run it and suggest solutions. Best of luck! To animate your camera in VR you will have to wrap it in a rig as described in the examples you can then move the rig: https://aframe.io/docs/1.3.0/components/camera.html#examples – Diego Marcos Feb 16 '22 at 19:48
  • 1
    You can listen to events coming from the controllers and manipulate the rig accordingly: https://aframe.io/docs/1.3.0/components/oculus-touch-controls.html#sidebar – Diego Marcos Feb 16 '22 at 19:49
  • 2
    Tried to describe re-using `wasd-controls`, ended up making a "component" x) – Piotr Adam Milewski Feb 16 '22 at 21:30

1 Answers1

5

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>
Piotr Adam Milewski
  • 14,150
  • 3
  • 21
  • 42
  • That is amazing and simple, I've been trying to find out how to do this for days now. Shame this example isn't given in the a-frame documentation. – Rich S Mar 07 '23 at 16:29