瀏覽代碼

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);