16 #ifndef BT_PERSISTENT_MANIFOLD_H 17 #define BT_PERSISTENT_MANIFOLD_H 25 struct btCollisionResult;
52 #define MANIFOLD_CACHE_SIZE 4 97 m_contactBreakingThreshold(contactBreakingThreshold),
98 m_contactProcessingThreshold(contactProcessingThreshold),
116 #ifdef DEBUG_PERSISTENCY 117 void DebugPersistency();
127 m_cachedPoints = cachedPoints;
133 return m_pointCache[index];
139 return m_pointCache[index];
152 m_contactBreakingThreshold = contactBreakingThreshold;
157 m_contactProcessingThreshold = contactProcessingThreshold;
170 if (index != lastUsedIndex)
172 m_pointCache[index] = m_pointCache[lastUsedIndex];
182 btAssert(m_pointCache[lastUsedIndex].m_userPersistentData == 0);
194 #define MAINTAIN_PERSISTENCY 1 195 #ifdef MAINTAIN_PERSISTENCY 196 int lifeTime = m_pointCache[insertIndex].
getLifeTime();
201 bool replacePoint =
true;
212 btScalar a = appliedLateralImpulse1 * appliedLateralImpulse1 + appliedLateralImpulse2 * appliedLateralImpulse2;
213 btScalar b = eps + mu * appliedImpulse;
215 replacePoint = (a) > (b);
223 m_pointCache[insertIndex] = newPoint;
230 m_pointCache[insertIndex].
m_lifeTime = lifeTime;
233 m_pointCache[insertIndex] = newPoint;
361 #ifdef BT_USE_DOUBLE_PRECISION 362 #define btPersistentManifoldData btPersistentManifoldDoubleData 363 #define btPersistentManifoldDataName "btPersistentManifoldDoubleData" 365 #define btPersistentManifoldData btPersistentManifoldFloatData 366 #define btPersistentManifoldDataName "btPersistentManifoldFloatData" 367 #endif //BT_USE_DOUBLE_PRECISION 369 #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 ...
const btCollisionObject * m_body1
btScalar getContactBreakingThreshold() const
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 m_appliedImpulseLateral1
btCollisionObjectFloatData * m_body1
void(* ContactEndedCallback)(btPersistentManifold *const &manifold)
int getNumContacts() const
float m_contactBreakingThreshold
btScalar m_appliedImpulse
double m_pointCacheCombinedFriction[4]
btVector3DoubleData m_pointCacheLocalPointB[4]
double m_pointCacheCombinedRollingFriction[4]
bool validContactDistance(const btManifoldPoint &pt) const
#define SIMD_FORCE_INLINE
ContactDestroyedCallback gContactDestroyedCallback
ManifoldContactPoint collects and maintains persistent contactpoints.
#define MANIFOLD_CACHE_SIZE
int sortCachedPoints(const btManifoldPoint &pt)
sort cached points so most isolated points come first
double m_pointCacheCombinedSpinningFriction[4]
const btManifoldPoint & getContactPoint(int index) const
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)
const btCollisionObject * getBody0() const
btScalar m_appliedImpulseLateral2
void(* ContactStartedCallback)(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.
float m_contactProcessingThreshold
btVector3DoubleData m_pointCacheLateralFrictionDir1[4]
btScalar getContactProcessingThreshold() const
ContactStartedCallback gContactStartedCallback
int calculateSerializeBufferSize() const
btCollisionObjectDoubleData * m_body0
bool(* ContactDestroyedCallback)(void *userPersistentData)
int m_pointCacheIndex0[4]
int m_pointCachePartId1[4]
#define ATTRIBUTE_ALIGNED16(a)
int m_pointCacheContactPointFlags[4]
int m_pointCacheIndex1[4]
void removeContactPoint(int index)
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
const btCollisionObject * getBody1() const
void clearUserCache(btManifoldPoint &pt)
double m_pointCacheFrictionCFM[4]
#define BT_DECLARE_ALIGNED_ALLOCATOR()
btScalar m_combinedFriction
btVector3DoubleData m_pointCacheLateralFrictionDir2[4]
const char * serialize(const class btPersistentManifold *manifold, void *dataBuffer, class btSerializer *serializer) const
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
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...
btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]
int getCacheEntry(const btManifoldPoint &newPoint) const