16 #ifndef BT_PERSISTENT_MANIFOLD_H 17 #define BT_PERSISTENT_MANIFOLD_H 26 struct btCollisionResult;
53 #define MANIFOLD_CACHE_SIZE 4 98 m_body0(body0),m_body1(body1),m_cachedPoints(0),
99 m_contactBreakingThreshold(contactBreakingThreshold),
100 m_contactProcessingThreshold(contactProcessingThreshold),
118 #ifdef DEBUG_PERSISTENCY 119 void DebugPersistency();
126 m_cachedPoints = cachedPoints;
133 return m_pointCache[index];
139 return m_pointCache[index];
152 m_contactBreakingThreshold = contactBreakingThreshold;
157 m_contactProcessingThreshold = contactProcessingThreshold;
173 if(index != lastUsedIndex)
175 m_pointCache[index] = m_pointCache[lastUsedIndex];
185 btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0);
197 #define MAINTAIN_PERSISTENCY 1 198 #ifdef MAINTAIN_PERSISTENCY 199 int lifeTime = m_pointCache[insertIndex].
getLifeTime();
204 bool replacePoint =
true;
215 btScalar a = appliedLateralImpulse1 * appliedLateralImpulse1 + appliedLateralImpulse2 * appliedLateralImpulse2;
216 btScalar b = eps + mu * appliedImpulse;
218 replacePoint = (a) > (b);
226 m_pointCache[insertIndex] = newPoint;
233 m_pointCache[insertIndex].
m_lifeTime = lifeTime;
236 m_pointCache[insertIndex] = newPoint;
365 #ifdef BT_USE_DOUBLE_PRECISION 366 #define btPersistentManifoldData btPersistentManifoldDoubleData 367 #define btPersistentManifoldDataName "btPersistentManifoldDoubleData" 369 #define btPersistentManifoldData btPersistentManifoldFloatData 370 #define btPersistentManifoldDataName "btPersistentManifoldFloatData" 371 #endif //BT_USE_DOUBLE_PRECISION 378 #endif //BT_PERSISTENT_MANIFOLD_H
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
int getCacheEntry(const btManifoldPoint &newPoint) const
const btCollisionObject * m_body1
btVector3DoubleData m_pointCachePositionWorldOnB[4]
double m_pointCacheAppliedImpulseLateral2[4]
double m_pointCacheContactMotion1[4]
void refreshContactPoints(const btTransform &trA, const btTransform &trB)
calculated new worldspace coordinates and depth, and reject points that exceed the collision margin ...
btCollisionObjectDoubleData * m_body1
btScalar getContactBreakingThreshold() const
btScalar m_appliedImpulseLateral1
btCollisionObjectFloatData * m_body1
float m_contactBreakingThreshold
btScalar m_appliedImpulse
double m_pointCacheCombinedFriction[4]
btVector3DoubleData m_pointCacheLocalPointB[4]
double m_pointCacheCombinedRollingFriction[4]
const char * serialize(const class btPersistentManifold *manifold, void *dataBuffer, class btSerializer *serializer) const
#define SIMD_FORCE_INLINE
ContactDestroyedCallback gContactDestroyedCallback
ManifoldContactPoint collects and maintains persistent contactpoints.
const btCollisionObject * getBody0() const
#define MANIFOLD_CACHE_SIZE
int sortCachedPoints(const btManifoldPoint &pt)
sort cached points so most isolated points come first
double m_pointCacheCombinedSpinningFriction[4]
int m_pointCacheLifeTime[4]
double m_pointCacheCombinedContactStiffness1[4]
btVector3DoubleData m_pointCacheNormalWorldOnB[4]
double m_pointCacheCombinedContactDamping1[4]
void setNumContacts(int cachedPoints)
the setNumContacts API is usually not used, except when you gather/fill all contacts manually ...
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
btVector3DoubleData m_pointCachePositionWorldOnA[4]
double m_pointCacheAppliedImpulse[4]
void * m_userPersistentData
btManifoldPoint & getContactPoint(int index)
btScalar m_appliedImpulseLateral2
void(* ContactEndedCallback)(btPersistentManifold *const &manifold)
double m_pointCacheContactMotion2[4]
double m_pointCacheDistance[4]
btScalar gContactBreakingThreshold
maximum contact breaking and merging threshold
btCollisionObject can be used to manage collision detection objects.
btScalar getContactProcessingThreshold() const
float m_contactProcessingThreshold
btVector3DoubleData m_pointCacheLateralFrictionDir1[4]
ContactStartedCallback gContactStartedCallback
const btManifoldPoint & getContactPoint(int index) const
btCollisionObjectDoubleData * m_body0
bool(* ContactDestroyedCallback)(void *userPersistentData)
int m_pointCacheIndex0[4]
int m_pointCachePartId1[4]
void(* ContactStartedCallback)(btPersistentManifold *const &manifold)
#define ATTRIBUTE_ALIGNED16(a)
int m_pointCacheContactPointFlags[4]
int m_pointCacheIndex1[4]
void removeContactPoint(int index)
int calculateSerializeBufferSize() const
ContactProcessedCallback gContactProcessedCallback
double m_contactProcessingThreshold
bool(* ContactProcessedCallback)(btManifoldPoint &cp, void *body0, void *body1)
rudimentary class to provide type info
double m_pointCacheCombinedRestitution[4]
double m_pointCacheContactCFM[4]
double m_contactBreakingThreshold
int getNumContacts() const
void clearUserCache(btManifoldPoint &pt)
double m_pointCacheFrictionCFM[4]
#define BT_DECLARE_ALIGNED_ALLOCATOR()
btScalar m_combinedFriction
btVector3DoubleData m_pointCacheLateralFrictionDir2[4]
double m_pointCacheAppliedImpulseLateral1[4]
btScalar m_contactProcessingThreshold
void setContactProcessingThreshold(btScalar contactProcessingThreshold)
btScalar m_contactBreakingThreshold
void deSerialize(const struct btPersistentManifoldDoubleData *manifoldDataPtr)
btPersistentManifold(const btCollisionObject *body0, const btCollisionObject *body1, int, btScalar contactBreakingThreshold, btScalar contactProcessingThreshold)
int m_pointCachePartId0[4]
btCollisionObjectFloatData * m_body0
btVector3DoubleData m_pointCacheLocalPointA[4]
void replaceContactPoint(const btManifoldPoint &newPoint, int insertIndex)
int findContactPoint(const btManifoldPoint *unUsed, int numUnused, const btManifoldPoint &pt)
void setContactBreakingThreshold(btScalar contactBreakingThreshold)
const btCollisionObject * m_body0
this two body pointers can point to the physics rigidbody class.
ContactEndedCallback gContactEndedCallback
const btCollisionObject * getBody1() const
double m_pointCacheContactERP[4]
int addManifoldPoint(const btManifoldPoint &newPoint, bool isPredictive=false)
void setBodies(const btCollisionObject *body0, const btCollisionObject *body1)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
bool validContactDistance(const btManifoldPoint &pt) const
btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]