Device Orientation camera touch enable

Hi! I have implemented device orientation camera for looking at 360 pictures from a mobile device, however as it only responds to orientation and not touch as well it’s not very user friendly.

Here is a good example how it should work:

If you open any panorama there with your mobile phone you will understand what I mean, as you can rotate the camera with touch, and when you stop, you can do it with device orientation and vice versa. So the user is not bound to one way of interacting with the camera.

Is there a way (except implementing my custom control) to get that in Device Orientation Camera in BabylonJS.

Many thanks in advance!


yes there is a way :wink:

just call camera._disablePointerInputWhenUsingDeviceOrientation = false after creating your camera

Doesn’t do the trick, at least on Chrome mobile. It continues to track the motion of the device and does not react on touch.

wait I misunderstood then. you want the camera to stop tracking device orientation when using the touch?

I want both of them to work simultaneously.

can you share a repro inthe PG?

It does work here, but it seems to reset the camera position after the control is handled back to the device sensors. Is there a way to keep the existing position intact?

Sorry for too many questions!

no need to be sorry :slight_smile:

this is what we do when transitioning from touch to the first device orientation event:

To support your use case we need to:

  • Detect when device orientation happens AFTER we were touching the screen
  • Update the initialQuaternion value accordingly

Do you want to give it a try?