Enable softness for btRigidBody contacts. This is implemented by some value (CFM, constraint force mixing) to the main diagonal of A.

CFM for contacts use world CFM value by default, and can override with custom CFM value using the
BT_CONTACT_FLAG_HAS_CONTACT_CFM stored in m_contactPointFlags.
Boolean m_lateralFrictionInitialized is replaced 'BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED' flag stored in int m_contactPointFlags in btManifoldPoint.
Enable successive over-relaxation parameter (SOR) for contacts. btMLCPSolver uses global CFM.
In one of the next commits, contact softness will be enabled btMultiBody contacts.
Also need to review use of CFM in btMLCPSolvers (only world CFM is used at the moment)
This commit is contained in:
erwin coumans
2016-01-22 17:43:36 -08:00
parent 6bc3f94f52
commit 645a88176d
6 changed files with 40 additions and 42 deletions

View File

@@ -35,7 +35,11 @@ typedef sce::PhysicsEffects::PfxConstraintRow btConstraintRow;
typedef btConstraintRow PfxConstraintRow;
#endif //PFX_USE_FREE_VECTORMATH
enum btContactPointFlags
{
BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED=1,
BT_CONTACT_FLAG_HAS_CONTACT_CFM=2,
};
/// ManifoldContactPoint collects and maintains persistent contactpoints.
/// used to improve stability and performance of rigidbody dynamics response.
@@ -44,14 +48,14 @@ class btManifoldPoint
public:
btManifoldPoint()
:m_userPersistentData(0),
m_lateralFrictionInitialized(false),
m_appliedImpulse(0.f),
m_contactPointFlags(0),
m_appliedImpulse(0.f),
m_appliedImpulseLateral1(0.f),
m_appliedImpulseLateral2(0.f),
m_contactMotion1(0.f),
m_contactMotion2(0.f),
m_contactCFM1(0.f),
m_contactCFM2(0.f),
m_contactCFM(0.f),
m_frictionCFM(0.f),
m_lifeTime(0)
{
}
@@ -67,14 +71,14 @@ class btManifoldPoint
m_combinedRollingFriction(btScalar(0.)),
m_combinedRestitution(btScalar(0.)),
m_userPersistentData(0),
m_lateralFrictionInitialized(false),
m_appliedImpulse(0.f),
m_contactPointFlags(0),
m_appliedImpulse(0.f),
m_appliedImpulseLateral1(0.f),
m_appliedImpulseLateral2(0.f),
m_contactMotion1(0.f),
m_contactMotion2(0.f),
m_contactCFM1(0.f),
m_contactCFM2(0.f),
m_contactCFM(0.f),
m_frictionCFM(0.f),
m_lifeTime(0)
{
@@ -101,15 +105,16 @@ class btManifoldPoint
int m_index1;
mutable void* m_userPersistentData;
bool m_lateralFrictionInitialized;
//bool m_lateralFrictionInitialized;
int m_contactPointFlags;
btScalar m_appliedImpulse;
btScalar m_appliedImpulseLateral1;
btScalar m_appliedImpulseLateral2;
btScalar m_contactMotion1;
btScalar m_contactMotion2;
btScalar m_contactCFM1;
btScalar m_contactCFM2;
btScalar m_contactCFM;
btScalar m_frictionCFM;
int m_lifeTime;//lifetime of the contactpoint in frames