Betaoffset for DeviceOrientationControls causes strange issue [SOLVED]


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:

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: