pitch = Math.asin((tz / 9.81 > 1)?1:(tz/9.81)) / Math.PI * 180;
roll = - Math.asin((ty / 9.81 > 1)?1:(ty/9.81)) / Math.PI * 180;
+ yaw = pitch ? ( yaw
+ - event.rotationRate.alpha / 1000 * event.interval * Math.cos(pitch * Math.PI / 180)
+ - event.rotationRate.gamma / 1000 * event.interval * Math.sin(pitch * Math.PI / 180)
+ ) % 360 : yaw;
+
// pitch = (pitch + event.rotationRate.beta / 1000 * event.interval) % 360;
// roll = (roll + event.rotationRate.gamma / 1000 * event.interval) % 360;
- yaw = (yaw - event.rotationRate.alpha / 1000 * event.interval) % 360;
// yaw = (yaw + ty) % 360;
};
})());