Преглед на файлове

Applied only if apply-gravity is on

Gravity is only applied when gravity is on. Bug fix.
Raanan Weber преди 10 години
родител
ревизия
65e1d0f98a
променени са 2 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 3 1
      Babylon/Cameras/babylon.freeCamera.js
  2. 3 1
      Babylon/Cameras/babylon.freeCamera.ts

+ 3 - 1
Babylon/Cameras/babylon.freeCamera.js

@@ -171,7 +171,9 @@ var BABYLON;
             globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);
             this._collider.radius = this.ellipsoid;
             //add gravity to the velocity to prevent the dual-collision checking
-            velocity.addInPlace(this.getScene().gravity);
+            if (this.applyGravity) {
+                velocity.addInPlace(this.getScene().gravity);
+            }
             this.getScene().collisionCoordinator.getNewPosition(this._oldPosition, velocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
         };
         FreeCamera.prototype._checkInputs = function () {

+ 3 - 1
Babylon/Cameras/babylon.freeCamera.ts

@@ -190,7 +190,9 @@
             this._collider.radius = this.ellipsoid;
 
             //add gravity to the velocity to prevent the dual-collision checking
-            velocity.addInPlace(this.getScene().gravity);
+            if(this.applyGravity) {
+                velocity.addInPlace(this.getScene().gravity);
+            }
 
             this.getScene().collisionCoordinator.getNewPosition(this._oldPosition, velocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);