Procházet zdrojové kódy

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

Julien před 12 roky
rodič
revize
51b9cb9307
1 změnil soubory, kde provedl 15 přidání a 0 odebrání
  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);
         }
     };