Piotr Adam Milewski
Piotr Adam Milewski

Reputation: 14645

How to disable gyro based rotation on mobile phones

i want to disable the camera rotation, while being on mobile.

I though making look-controls="hmdEnabled:false" would disable moving the camera along with the mobile device, yet it didn't work.

I tried to find which controls should i disable, but i only found some intel stating, that WebVr drivers rotate the scene @HMD orientation, not directly from the gyroscopes.

Nonetheless, I have no idea how to lock the camera, so it can be only moved by dragging Your finger.

Thanks in advance

Upvotes: 0

Views: 3455

Answers (2)

geekonaut
geekonaut

Reputation: 5954

I packaged up a component that does this at https://github.com/AVGP/a-touch-controls:

<a-scene>
  <a-entity camera touch-controls></a-entity>
</a-scene>

These controls are using mouse (click and drag) or finger (swipe) movements to move around the camera, but does not use the gyroscope on mobile, except when explicitely entering VR mode, which still permits Cardboard usage etc.

Upvotes: 3

ngokevin
ngokevin

Reputation: 13233

If you want your own control scheme, you'll need to make your own controls. You can copy and paste some code from the look-controls and customize it: https://github.com/aframevr/aframe/blob/master/src/components/look-controls.js

Upvotes: 1

Related Questions