I'm trying to implement deviceorientation
but the angles I get are changed when I rotate the mobile around its own axis
What I'm trying to do is detect rotation according to another reference, kinda like the diagram below
(async function () {
// await window.DeviceOrientationEvent.requestPermission();
function onDeviceOrientation(e) {
document.querySelector("#angles").innerHTML = JSON.stringify(
{
alpha: e.alpha,
beta: e.beta,
gamma: e.gamma
},
null,
4
);
}
window.addEventListener("deviceorientation", onDeviceOrientation);
})();
I don't find an option in the API to make the movement in reference to another frame so I suppose I should make it manually, could it be achieved?