浏览代码

Added a inertia epsilon on free camera movment (like in arcRotateCamera).

Julien 11 年之前
父节点
当前提交
51b9cb9307
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      Babylon/Cameras/babylon.freeCamera.js

+ 15 - 0
Babylon/Cameras/babylon.freeCamera.js

@@ -344,9 +344,24 @@ var BABYLON = BABYLON || {};
 
         // Inertia
         if (needToMove) {
+            if (Math.abs(this.cameraDirection.x) < BABYLON.Engine.epsilon)
+                this.cameraDirection.x = 0;
+
+            if (Math.abs(this.cameraDirection.y) < BABYLON.Engine.epsilon)
+                this.cameraDirection.y = 0;
+
+            if (Math.abs(this.cameraDirection.z) < BABYLON.Engine.epsilon)
+                this.cameraDirection.z = 0;
+        
             this.cameraDirection.scaleInPlace(this.inertia);
         }
         if (needToRotate) {
+            if (Math.abs(this.cameraRotation.x) < BABYLON.Engine.epsilon)
+                this.cameraRotation.x = 0;
+
+            if (Math.abs(this.cameraRotation.y) < BABYLON.Engine.epsilon)
+                this.cameraRotation.y = 0;
+        
             this.cameraRotation.scaleInPlace(this.inertia);
         }
     };