43#ifdef DEBUG_PERSISTENCY
45void btPersistentManifold::DebugPersistency()
51 printf(
"m_pointCache[%d].m_userPersistentData = %x\n",i,
m_pointCache[i].m_userPersistentData);
62#ifdef DEBUG_PERSISTENCY
71 printf(
"error in clearUserCache\n");
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;
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",
262 for (i=getNumContacts()-1;i>=0;i--)
273 btVector3 projectedDifference,projectedPoint;
288 distance2d = projectedDifference.
dot(projectedDifference);
296 (*gContactProcessedCallback)(manifoldPoint,(
void*)
m_body0,(
void*)
m_body1);
300#ifdef DEBUG_PERSISTENCY
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
const T & btMax(const T &a, const T &b)
bool gContactCalcArea3Points
gContactCalcArea3Points will approximate the convex hull area using 3 points when setting it to false...
ContactEndedCallback gContactEndedCallback
static btScalar calcArea4Points(const btVector3 &p0, const btVector3 &p1, const btVector3 &p2, const btVector3 &p3)
ContactStartedCallback gContactStartedCallback
ContactProcessedCallback gContactProcessedCallback
ContactDestroyedCallback gContactDestroyedCallback
btScalar gContactBreakingThreshold
maximum contact breaking and merging threshold
void(* ContactEndedCallback)(btPersistentManifold *const &manifold)
bool(* ContactDestroyedCallback)(void *userPersistentData)
void(* ContactStartedCallback)(btPersistentManifold *const &manifold)
@ BT_PERSISTENT_MANIFOLD_TYPE
#define MANIFOLD_CACHE_SIZE
bool(* ContactProcessedCallback)(btManifoldPoint &cp, void *body0, void *body1)
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...
ManifoldContactPoint collects and maintains persistent contactpoints.
btScalar getDistance() const
btVector3 m_positionWorldOnA
m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
void * m_userPersistentData
btVector3 m_normalWorldOnB
btVector3 m_positionWorldOnB
const btCollisionObject * m_body1
btScalar m_contactBreakingThreshold
bool validContactDistance(const btManifoldPoint &pt) const
int getCacheEntry(const btManifoldPoint &newPoint) const
void refreshContactPoints(const btTransform &trA, const btTransform &trB)
calculated new worldspace coordinates and depth, and reject points that exceed the collision margin
int sortCachedPoints(const btManifoldPoint &pt)
sort cached points so most isolated points come first
void clearUserCache(btManifoldPoint &pt)
void removeContactPoint(int index)
int getNumContacts() const
int addManifoldPoint(const btManifoldPoint &newPoint, bool isPredictive=false)
btScalar getContactBreakingThreshold() const
const btCollisionObject * m_body0
this two body pointers can point to the physics rigidbody class.
btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]
btVector3 can be used to represent 3D points and vectors.
const btScalar & getZ() const
Return the z value.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btScalar dot(const btVector3 &v) const
Return the dot product.
btScalar length2() const
Return the length of the vector squared.
const btScalar & getY() const
Return the y value.
const btScalar & getX() const
Return the x value.
rudimentary class to provide type info