Betaoffset for DeviceOrientationControls causes strange issue [SOLVED]

Hi,

I’ve been playing around with the “DeviceOrientationControls” of three.js.

I’d like to extend it for a special use-case, where users would be able to control the camera by swiping as well. I can see that there’s an alphaOffset already that I can use, but there’s no betaOffset by default.

So I added one for testing. You can change the betaOffset value by changing the inputfield on the top, see my modified example: https://vrtual.house/development/deviceorientation

Now, my problem is that if betaOffset is not equal to 0, and I’m holding my phone in portrait mode and tilting it horizontally, at some point I’m having a strange flickering / jolting effect.

You can easily replicate the issue if you set the betaOffset to 1, for example. In this case, you’ll have to “look” a little bit higher with your phone to find that “hot area”, where this strange effect happens.

Anyone has an idea why this happens, and how (if) it can be solved?

Many thanks

Okay, I’ve finally made a solution myself, based on the accepted answer on this page: https://stackoverflow.com/questions/35283320/three-js-rotate-camera-with-both-touch-and-device-orientation

2 Likes