Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-02-05 18:39:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-02-05 18:39:43 +0400
commit81048fed749776089a5617f30106e9cf43c233a3 (patch)
tree825b2b345b5a46b46d6c1d8b874d7ddc74bafb80 /extern
parentc8f5dac11bb67aa005502d62855292e41252bbb4 (diff)
parent04a079668c2d72ea00f2537fa88fdca2728c5aa2 (diff)
Merging r43871 through r43908 from trunk into soc-2011-tomato
Diffstat (limited to 'extern')
-rw-r--r--extern/bullet2/src/BulletSoftBody/btSoftBody.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp b/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
index a90acb99f04..0d19fd193e7 100644
--- a/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
+++ b/extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
@@ -2780,21 +2780,23 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb, btScalar kst, btScalar ti)
{
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);
+ }
}
}
}