I more detailed explained our problem, why we started smoothing deviceOrientation camera here: Fixing DeviceOrientationCamera noize for android devices

We almost found out perfect solution, but we only have problem smoothing, when alpha value goes from 0 to 360 and from 360 to 0. We cant find a solution. It is really hard to average Quaternions. When alpha goes from 0->360 (x,y,-z,w) → (**-x**,y,-z,**-w**) and the other way around, but this just doesn’t smooth nice enough

Does anyone has a mathematical solution how to solve this problem in the code?

PLAYGROUND: https://www.babylonjs-playground.com/#14KRGG#619