|
Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
43 #ifdef DEBUG_PERSISTENCY
45 void btPersistentManifold::DebugPersistency()
51 printf(
"m_pointCache[%d].m_userPersistentData = %x\n",i,
m_pointCache[i].m_userPersistentData);
54 #endif //DEBUG_PERSISTENCY
62 #ifdef DEBUG_PERSISTENCY
71 printf(
"error in clearUserCache\n");
75 #endif //DEBUG_PERSISTENCY
83 #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) {
171 if(maxPenetrationIndex != 1) {
175 if(maxPenetrationIndex != 2) {
179 if(maxPenetrationIndex != 3) {
194 int nearestPoint = -1;
195 for(
int i = 0; i <
size; i++ )
201 if( distToManiPoint < shortestDist )
203 shortestDist = distToManiPoint;
220 #if MANIFOLD_CACHE_SIZE >= 4
252 #ifdef DEBUG_PERSISTENCY
253 printf(
"refreshContactPoints posA = (%f,%f,%f) posB = (%f,%f,%f)\n",
260 #endif //DEBUG_PERSISTENCY
273 btVector3 projectedDifference,projectedPoint;
288 distance2d = projectedDifference.
dot(projectedDifference);
296 (*gContactProcessedCallback)(manifoldPoint,(
void*)
m_body0,(
void*)
m_body1);
300 #ifdef DEBUG_PERSISTENCY
bool(* ContactDestroyedCallback)(void *userPersistentData)
ContactProcessedCallback gContactProcessedCallback
btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]
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 btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
bool(* ContactProcessedCallback)(btManifoldPoint &cp, void *body0, void *body1)
ContactDestroyedCallback gContactDestroyedCallback
void(* ContactStartedCallback)(btPersistentManifold *const &manifold)
btVector3 m_normalWorldOnB
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
void clearUserCache(btManifoldPoint &pt)
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.
int getNumContacts() const
btScalar getDistance() const
int sortCachedPoints(const btManifoldPoint &pt)
sort cached points so most isolated points come first
bool validContactDistance(const btManifoldPoint &pt) const
const T & btMax(const T &a, const T &b)
const btScalar & getX() const
Return the x value.
static btScalar calcArea4Points(const btVector3 &p0, const btVector3 &p1, const btVector3 &p2, const btVector3 &p3)
btVector3 m_positionWorldOnB
ManifoldContactPoint collects and maintains persistent contactpoints.
void * m_userPersistentData
ContactEndedCallback gContactEndedCallback
void removeContactPoint(int index)
btVector3 can be used to represent 3D points and vectors.
int addManifoldPoint(const btManifoldPoint &newPoint, bool isPredictive=false)
const btScalar & getZ() const
Return the z value.
const btScalar & getY() const
Return the y value.
#define MANIFOLD_CACHE_SIZE
btVector3 m_positionWorldOnA
m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
rudimentary class to provide type info
@ BT_PERSISTENT_MANIFOLD_TYPE
btScalar m_contactBreakingThreshold
const btCollisionObject * m_body1
int getCacheEntry(const btManifoldPoint &newPoint) const
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
btScalar getContactBreakingThreshold() const
ContactStartedCallback gContactStartedCallback
btScalar length2() const
Return the length of the vector squared.
void(* ContactEndedCallback)(btPersistentManifold *const &manifold)
const btCollisionObject * m_body0
this two body pointers can point to the physics rigidbody class.