[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43905] trunk/blender/extern/bullet2/src/ BulletSoftBody/btSoftBody.cpp: BGE bug #18883: Softbodies being hit by ghost objects.

Benoit Bolsee benoit.bolsee at online.be
Sun Feb 5 14:04:21 CET 2012


Revision: 43905
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43905
Author:   ben2610
Date:     2012-02-05 13:04:13 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
BGE bug #18883: Softbodies being hit by ghost objects.  Added a one liner fix in Bullet. I will also report the fix to Erwin so that it can be added to next Bullet version.

Modified Paths:
--------------
    trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp

Modified: trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
===================================================================
--- trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp	2012-02-05 12:50:01 UTC (rev 43904)
+++ trunk/blender/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp	2012-02-05 13:04:13 UTC (rev 43905)
@@ -2780,21 +2780,23 @@
 	{
 		const RContact&		c = psb->m_rcontacts[i];
 		const sCti&			cti = c.m_cti;	
-		btRigidBody* tmpRigid = btRigidBody::upcast(cti.m_colObj);
 
-		const btVector3		va = tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
-		const btVector3		vb = c.m_node->m_x-c.m_node->m_q;	
-		const btVector3		vr = vb-va;
-		const btScalar		dn = btDot(vr, cti.m_normal);		
-		if(dn<=SIMD_EPSILON)
-		{
-			const btScalar		dp = btMin( (btDot(c.m_node->m_x, cti.m_normal) + cti.m_offset), mrg );
-			const btVector3		fv = vr - (cti.m_normal * dn);
-			// c0 is the impulse matrix, c3 is 1 - the friction coefficient or 0, c4 is the contact hardness coefficient
-			const btVector3		impulse = c.m_c0 * ( (vr - (fv * c.m_c3) + (cti.m_normal * (dp * c.m_c4))) * kst );
-			c.m_node->m_x -= impulse * c.m_c2;
-			if (tmpRigid)
-				tmpRigid->applyImpulse(impulse,c.m_c1);
+		if (cti.m_colObj->hasContactResponse()) {
+			btRigidBody* tmpRigid = btRigidBody::upcast(cti.m_colObj);
+			const btVector3		va = tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
+			const btVector3		vb = c.m_node->m_x-c.m_node->m_q;	
+			const btVector3		vr = vb-va;
+			const btScalar		dn = btDot(vr, cti.m_normal);		
+			if(dn<=SIMD_EPSILON)
+			{
+				const btScalar		dp = btMin( (btDot(c.m_node->m_x, cti.m_normal) + cti.m_offset), mrg );
+				const btVector3		fv = vr - (cti.m_normal * dn);
+				// c0 is the impulse matrix, c3 is 1 - the friction coefficient or 0, c4 is the contact hardness coefficient
+				const btVector3		impulse = c.m_c0 * ( (vr - (fv * c.m_c3) + (cti.m_normal * (dp * c.m_c4))) * kst );
+				c.m_node->m_x -= impulse * c.m_c2;
+				if (tmpRigid)
+					tmpRigid->applyImpulse(impulse,c.m_c1);
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list