From f8de35a9e86dbe809785dca010a87d21c42edfa7 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 18 Feb 2013 22:13:18 +0000 Subject: [PATCH] - change BetterCharacterControl damping to be framerate decoupled git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10414 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/bullet/control/BetterCharacterControl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/bullet-common/com/jme3/bullet/control/BetterCharacterControl.java b/engine/src/bullet-common/com/jme3/bullet/control/BetterCharacterControl.java index 760986268..af26fde31 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/BetterCharacterControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/BetterCharacterControl.java @@ -110,7 +110,7 @@ public class BetterCharacterControl extends AbstractPhysicsControl implements Ph protected final Vector3f rotatedViewDirection = new Vector3f(0, 0, 1); protected final Vector3f walkDirection = new Vector3f(); protected final Vector3f jumpForce; - protected float physicsDamping = 10f; + protected float physicsDamping = 0.9f; protected final Vector3f scale = new Vector3f(1, 1, 1); protected final Vector3f velocity = new Vector3f(); protected boolean jump = false; @@ -175,8 +175,8 @@ public class BetterCharacterControl extends AbstractPhysicsControl implements Ph float existingLeftVelocity = velocity.dot(localLeft); float existingForwardVelocity = velocity.dot(localForward); Vector3f counter = vars.vect1; - existingLeftVelocity = existingLeftVelocity * tpf * physicsDamping; - existingForwardVelocity = existingForwardVelocity * tpf * physicsDamping; + existingLeftVelocity = existingLeftVelocity * physicsDamping; + existingForwardVelocity = existingForwardVelocity * physicsDamping; counter.set(-existingLeftVelocity, 0, -existingForwardVelocity); localForwardRotation.multLocal(counter); velocity.addLocal(counter); @@ -430,7 +430,7 @@ public class BetterCharacterControl extends AbstractPhysicsControl implements Ph /** * Sets how much the physics forces in the local x/z plane should be * dampened. - * @param physicsDamping The dampening value, 0 = no dampening, default = 10 + * @param physicsDamping The dampening value, 0 = no dampening, 1 = no external force, default = 0.9 */ public void setPhysicsDamping(float physicsDamping) { this.physicsDamping = physicsDamping;