瀏覽代碼

making sure rotation is updating only when needed

Only testing if alpha is not 0. this will never happen when the device
already sending information, as no device is so exact that it will
provide an exact 0. and even if it will, it will probably be for a
single frame.
Raanan Weber 9 年之前
父節點
當前提交
ca825a2fa9
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.ts

+ 3 - 0
src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.ts

@@ -51,6 +51,9 @@ module BABYLON {
         }
 
         public checkInputs() {
+            //if no device orientation provided, don't update the rotation.
+            //Only testing against alpha under the assumption thatnorientation will never be so exact when set.
+            if(!this._alpha) return;
             Quaternion.RotationYawPitchRollToRef(BABYLON.Tools.ToRadians(this._alpha), BABYLON.Tools.ToRadians(this._beta), -BABYLON.Tools.ToRadians(this._gamma), this.camera.rotationQuaternion)
             this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);
             this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);