X-Git-Url: http://git.plutz.net/?p=serve0;a=blobdiff_plain;f=stereoview.js;fp=stereoview.js;h=d2c4ec54cfb2d093acdd876ef6ab70af28026ef7;hp=3b0faa79bb83da4aca67a46afb5e06878ac26a86;hb=8f4a82221dc72c6571048246497cebfba6bf063f;hpb=73e4a59c307fa8f9b46e76fb0d9839277198e353 diff --git a/stereoview.js b/stereoview.js index 3b0faa7..d2c4ec5 100644 --- a/stereoview.js +++ b/stereoview.js @@ -131,9 +131,13 @@ function stereoview(layout, video) { 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; }; })());