瀏覽代碼

Added a little offset to the physics ray to correct detecting onGround

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10705 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
iwg..ic 12 年之前
父節點
當前提交
20d5565cb7
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      engine/src/bullet-common/com/jme3/bullet/control/BetterCharacterControl.java

+ 2 - 2
engine/src/bullet-common/com/jme3/bullet/control/BetterCharacterControl.java

@@ -443,7 +443,7 @@ public class BetterCharacterControl extends AbstractPhysicsControl implements Ph
     public float getPhysicsDamping() {
     public float getPhysicsDamping() {
         return physicsDamping;
         return physicsDamping;
     }
     }
-    
+
     /**
     /**
      * This actually sets a new collision shape to the character to change the
      * This actually sets a new collision shape to the character to change the
      * height of the capsule.
      * height of the capsule.
@@ -464,7 +464,7 @@ public class BetterCharacterControl extends AbstractPhysicsControl implements Ph
         Vector3f rayVector = vars.vect2;
         Vector3f rayVector = vars.vect2;
         float height = getFinalHeight();
         float height = getFinalHeight();
         location.set(localUp).multLocal(height).addLocal(this.location);
         location.set(localUp).multLocal(height).addLocal(this.location);
-        rayVector.set(localUp).multLocal(-height - FastMath.ZERO_TOLERANCE).addLocal(location);
+        rayVector.set(localUp).multLocal(-height - 0.1f).addLocal(location);
         List<PhysicsRayTestResult> results = space.rayTest(location, rayVector);
         List<PhysicsRayTestResult> results = space.rayTest(location, rayVector);
         vars.release();
         vars.release();
         for (PhysicsRayTestResult physicsRayTestResult : results) {
         for (PhysicsRayTestResult physicsRayTestResult : results) {