16 #ifndef BT_PERSISTENT_MANIFOLD_H
17 #define BT_PERSISTENT_MANIFOLD_H
26 struct btCollisionResult;
43 #define MANIFOLD_CACHE_SIZE 4
88 m_body0(body0),m_body1(body1),m_cachedPoints(0),
89 m_contactBreakingThreshold(contactBreakingThreshold),
90 m_contactProcessingThreshold(contactProcessingThreshold)
105 #ifdef DEBUG_PERSISTENCY
106 void DebugPersistency();
113 m_cachedPoints = cachedPoints;
120 return m_pointCache[index];
126 return m_pointCache[index];
130 btScalar getContactBreakingThreshold()
const;
134 return m_contactProcessingThreshold;
139 m_contactBreakingThreshold = contactBreakingThreshold;
144 m_contactProcessingThreshold = contactProcessingThreshold;
152 int addManifoldPoint(
const btManifoldPoint& newPoint,
bool isPredictive=
false);
156 clearUserCache(m_pointCache[index]);
158 int lastUsedIndex = getNumContacts() - 1;
160 if(index != lastUsedIndex)
162 m_pointCache[index] = m_pointCache[lastUsedIndex];
172 btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0);
177 btAssert(validContactDistance(newPoint));
179 #define MAINTAIN_PERSISTENCY 1
180 #ifdef MAINTAIN_PERSISTENCY
181 int lifeTime = m_pointCache[insertIndex].
getLifeTime();
192 m_pointCache[insertIndex] = newPoint;
204 m_pointCache[insertIndex].
m_lifeTime = lifeTime;
206 clearUserCache(m_pointCache[insertIndex]);
207 m_pointCache[insertIndex] = newPoint;
215 return pt.
m_distance1 <= getContactBreakingThreshold();
224 for (i=0;i<m_cachedPoints;i++)
226 clearUserCache(m_pointCache[i]);
240 #endif //BT_PERSISTENT_MANIFOLD_H
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
const btCollisionObject * m_body1
btScalar m_appliedImpulseLateral1
#define ATTRIBUTE_ALIGNED128(a)
btScalar m_appliedImpulse
#define SIMD_FORCE_INLINE
ContactDestroyedCallback gContactDestroyedCallback
ManifoldContactPoint collects and maintains persistent contactpoints.
const btCollisionObject * getBody0() const
#define MANIFOLD_CACHE_SIZE
void setNumContacts(int cachedPoints)
the setNumContacts API is usually not used, except when you gather/fill all contacts manually ...
void * m_userPersistentData
btManifoldPoint & getContactPoint(int index)
btScalar m_appliedImpulseLateral2
btScalar gContactBreakingThreshold
maximum contact breaking and merging threshold
btCollisionObject can be used to manage collision detection objects.
btScalar getContactProcessingThreshold() const
bool(* ContactProcessedCallback)(btManifoldPoint &cp, void *body0, void *body1)
const btManifoldPoint & getContactPoint(int index) const
void removeContactPoint(int index)
ContactProcessedCallback gContactProcessedCallback
rudimentary class to provide type info
int getNumContacts() const
#define BT_DECLARE_ALIGNED_ALLOCATOR()
bool m_lateralFrictionInitialized
btScalar m_contactProcessingThreshold
void setContactProcessingThreshold(btScalar contactProcessingThreshold)
btScalar m_contactBreakingThreshold
btPersistentManifold(const btCollisionObject *body0, const btCollisionObject *body1, int, btScalar contactBreakingThreshold, btScalar contactProcessingThreshold)
void replaceContactPoint(const btManifoldPoint &newPoint, int insertIndex)
void setContactBreakingThreshold(btScalar contactBreakingThreshold)
const btCollisionObject * m_body0
this two body pointers can point to the physics rigidbody class.
const btCollisionObject * getBody1() const
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(* ContactDestroyedCallback)(void *userPersistentData)
bool validContactDistance(const btManifoldPoint &pt) const