feat: use rotation matrix to derive acceleration ax

refs:
https://www.w3.org/TR/orientation-event/#examples
This commit is contained in:
Usu171
2025-12-14 01:26:55 +08:00
parent 93f50b4812
commit dc48c866c2

View File

@@ -64,10 +64,7 @@ export class DeviceOrientationInteraction {
const g = 9.8;
const toRad = Math.PI / 180;
this.ax =
alpha > 180
? g * Math.sin((gamma - 180) * toRad)
: g * Math.sin(gamma * toRad);
this.ax = g * Math.sin(gamma * toRad) * Math.cos(beta * toRad);
this.ay = g * Math.sin(beta * toRad);
}