Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
20 #ifdef BT_USE_DOUBLE_PRECISION
21 #define btCollisionObjectData btCollisionObjectDoubleData
23 #define btCollisionObjectData btCollisionObjectFloatData
46 #ifdef DEBUG_PERSISTENCY
48 void btPersistentManifold::DebugPersistency()
54 printf(
"m_pointCache[%d].m_userPersistentData = %x\n", i,
m_pointCache[i].m_userPersistentData);
57 #endif //DEBUG_PERSISTENCY
64 #ifdef DEBUG_PERSISTENCY
73 printf(
"error in clearUserCache\n");
77 #endif //DEBUG_PERSISTENCY
85 #ifdef DEBUG_PERSISTENCY
116 int maxPenetrationIndex = -1;
117 #define KEEP_DEEPEST_POINT 1
118 #ifdef KEEP_DEEPEST_POINT
120 for (
int i = 0; i < 4; i++)
124 maxPenetrationIndex = i;
128 #endif //KEEP_DEEPEST_POINT
134 if (maxPenetrationIndex != 0)
141 if (maxPenetrationIndex != 1)
149 if (maxPenetrationIndex != 2)
157 if (maxPenetrationIndex != 3)
167 if (maxPenetrationIndex != 0)
172 if (maxPenetrationIndex != 1)
177 if (maxPenetrationIndex != 2)
182 if (maxPenetrationIndex != 3)
187 btVector4 maxvec(res0, res1, res2, res3);
196 int nearestPoint = -1;
197 for (
int i = 0; i <
size; i++)
203 if (distToManiPoint < shortestDist)
205 shortestDist = distToManiPoint;
222 #if MANIFOLD_CACHE_SIZE >= 4
250 #ifdef DEBUG_PERSISTENCY
251 printf(
"refreshContactPoints posA = (%f,%f,%f) posB = (%f,%f,%f)\n",
258 #endif //DEBUG_PERSISTENCY
271 btVector3 projectedDifference, projectedPoint;
286 distance2d = projectedDifference.
dot(projectedDifference);
295 (*gContactProcessedCallback)(manifoldPoint, (
void*)
m_body0, (
void*)
m_body1);
299 #ifdef DEBUG_PERSISTENCY
321 dataOut->m_index1a = manifold->
m_index1a;
336 dataOut->m_pointCacheLifeTime[i] = pt.
m_lifeTime;
341 dataOut->m_pointCacheIndex0[i] = pt.
m_index0;
342 dataOut->m_pointCacheIndex1[i] = pt.
m_index1;
343 dataOut->m_pointCachePartId0[i] = pt.
m_partId0;
344 dataOut->m_pointCachePartId1[i] = pt.
m_partId1;
int m_pointCachePartId1[4]
bool(* ContactDestroyedCallback)(void *userPersistentData)
ContactProcessedCallback gContactProcessedCallback
btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]
void serialize(struct btVector3Data &dataOut) const
int m_pointCacheIndex0[4]
#define btPersistentManifoldDataName
btVector3 m_lateralFrictionDir2
btScalar m_contactMotion2
void refreshContactPoints(const btTransform &trA, const btTransform &trB)
calculated new worldspace coordinates and depth, and reject points that exceed the collision margin
btScalar gContactBreakingThreshold
maximum contact breaking and merging threshold
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
float m_pointCacheCombinedRestitution[4]
btVector3FloatData m_pointCacheLateralFrictionDir1[4]
btVector3FloatData m_pointCachePositionWorldOnB[4]
float m_contactProcessingThreshold
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
int m_pointCacheContactPointFlags[4]
bool(* ContactProcessedCallback)(btManifoldPoint &cp, void *body0, void *body1)
ContactDestroyedCallback gContactDestroyedCallback
btVector3 m_normalWorldOnB
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
virtual void * getUniquePointer(void *oldPtr)=0
void deSerialize(const struct btPersistentManifoldDoubleData *manifoldDataPtr)
const btCollisionObject * getBody0() const
void clearUserCache(btManifoldPoint &pt)
btVector3DoubleData m_pointCacheLateralFrictionDir2[4]
int m_pointCacheIndex1[4]
bool gContactCalcArea3Points
gContactCalcArea3Points will approximate the convex hull area using 3 points when setting it to false...
btScalar dot(const btVector3 &v) const
Return the dot product.
float m_pointCacheAppliedImpulseLateral1[4]
int getNumContacts() const
float m_pointCacheDistance[4]
float m_pointCacheCombinedRollingFriction[4]
#define btCollisionObjectData
int m_pointCachePartId0[4]
btScalar getDistance() const
btScalar m_combinedRestitution
float m_pointCacheAppliedImpulseLateral2[4]
int sortCachedPoints(const btManifoldPoint &pt)
sort cached points so most isolated points come first
btScalar m_contactProcessingThreshold
float m_pointCacheCombinedSpinningFriction[4]
btVector3FloatData m_pointCacheLocalPointB[4]
bool validContactDistance(const btManifoldPoint &pt) const
const T & btMax(const T &a, const T &b)
int m_pointCacheIndex0[4]
const btScalar & getX() const
Return the x value.
double m_pointCacheCombinedSpinningFriction[4]
double m_pointCacheAppliedImpulseLateral1[4]
double m_pointCacheAppliedImpulse[4]
static btScalar calcArea4Points(const btVector3 &p0, const btVector3 &p1, const btVector3 &p2, const btVector3 &p3)
btVector3FloatData m_pointCacheNormalWorldOnB[4]
btScalar m_combinedContactDamping1
int m_pointCacheLifeTime[4]
double m_pointCacheCombinedContactStiffness1[4]
btVector3 m_positionWorldOnB
ManifoldContactPoint collects and maintains persistent contactpoints.
btScalar m_contactMotion1
btVector3DoubleData m_pointCacheNormalWorldOnB[4]
btScalar m_combinedSpinningFriction
double m_pointCacheCombinedContactDamping1[4]
void * m_userPersistentData
double m_pointCacheCombinedRestitution[4]
int m_pointCachePartId0[4]
double m_pointCacheCombinedFriction[4]
double m_pointCacheCombinedRollingFriction[4]
btScalar getContactProcessingThreshold() const
double m_pointCacheDistance[4]
int calculateSerializeBufferSize() const
ContactEndedCallback gContactEndedCallback
float m_pointCacheCombinedContactStiffness1[4]
void removeContactPoint(int index)
double m_pointCacheContactERP[4]
double m_pointCacheFrictionCFM[4]
btVector3 can be used to represent 3D points and vectors.
btVector3DoubleData m_pointCacheLateralFrictionDir1[4]
btVector3FloatData m_pointCacheLateralFrictionDir2[4]
btScalar m_combinedRollingFriction
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
int addManifoldPoint(const btManifoldPoint &newPoint, bool isPredictive=false)
float m_pointCacheContactCFM[4]
const btScalar & getZ() const
Return the z value.
btVector3DoubleData m_pointCacheLocalPointA[4]
double m_pointCacheAppliedImpulseLateral2[4]
btScalar m_appliedImpulseLateral1
const btScalar & getY() const
Return the y value.
void(* ContactEndedCallback)(btPersistentManifold *const &manifold)
float m_pointCacheAppliedImpulse[4]
int m_pointCacheLifeTime[4]
btVector3FloatData m_pointCachePositionWorldOnA[4]
#define MANIFOLD_CACHE_SIZE
float m_pointCacheContactERP[4]
double m_contactBreakingThreshold
double m_pointCacheContactMotion2[4]
btVector3 m_positionWorldOnA
m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
rudimentary class to provide type info
#define btPersistentManifoldData
float m_contactBreakingThreshold
float m_pointCacheCombinedContactDamping1[4]
void deSerializeDouble(const struct btVector3DoubleData &dataIn)
int m_pointCacheIndex1[4]
const char * serialize(const class btPersistentManifold *manifold, void *dataBuffer, class btSerializer *serializer) const
btVector3DoubleData m_pointCachePositionWorldOnA[4]
const btManifoldPoint & getContactPoint(int index) const
btScalar m_contactBreakingThreshold
btVector3FloatData m_pointCacheLocalPointA[4]
void deSerialize(const struct btVector3DoubleData &dataIn)
float m_pointCacheFrictionCFM[4]
int m_pointCacheContactPointFlags[4]
btVector3DoubleData m_pointCachePositionWorldOnB[4]
const btCollisionObject * m_body1
btVector3 m_lateralFrictionDir1
double m_pointCacheContactMotion1[4]
const btCollisionObject * getBody1() const
float m_pointCacheContactMotion1[4]
btScalar m_appliedImpulse
double m_contactProcessingThreshold
int m_pointCachePartId1[4]
double m_pointCacheContactCFM[4]
float m_pointCacheCombinedFriction[4]
int getCacheEntry(const btManifoldPoint &newPoint) const
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
btScalar m_appliedImpulseLateral2
btScalar getContactBreakingThreshold() const
btScalar m_combinedFriction
ContactStartedCallback gContactStartedCallback
btScalar m_combinedContactStiffness1
float m_pointCacheContactMotion2[4]
void(* ContactStartedCallback)(btPersistentManifold *const &manifold)
btScalar length2() const
Return the length of the vector squared.
btVector3DoubleData m_pointCacheLocalPointB[4]
const btCollisionObject * m_body0
this two body pointers can point to the physics rigidbody class.