[Bf-blender-cvs] [3a53ed8] master: Remove an assert in Bullet for the Character physics.

Benoit Bolsee noreply at git.blender.org
Sun Aug 10 00:39:37 CEST 2014


Commit: 3a53ed8d1babd43df62a29d5a46836350a795091
Author: Benoit Bolsee
Date:   Sun Aug 10 00:36:32 2014 +0200
Branches: master
https://developer.blender.org/rB3a53ed8d1babd43df62a29d5a46836350a795091

Remove an assert in Bullet for the Character physics.

This assert happens all the time for character physics in debug mode.
In release mode, the assert is skipped but the code is still incorrect
although it does not cause any crash strangely.

===================================================================

M	extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp

===================================================================

diff --git a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
index 8f1cd20..8d940e6 100644
--- a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
+++ b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
@@ -29,10 +29,13 @@ subject to the following restrictions:
 static btVector3
 getNormalizedVector(const btVector3& v)
 {
-	btVector3 n = v.normalized();
-	if (n.length() < SIMD_EPSILON) {
-		n.setValue(0, 0, 0);
-	}
+    btScalar l = v.length();
+    btVector3 n = v;
+    if (l < SIMD_EPSILON) {
+        n.setValue(0,0,0);
+    } else {
+        n /= l;
+    }
 	return n;
 }




More information about the Bf-blender-cvs mailing list