76 btScalar denom = 1.0f - dirA_dot_dirB * dirA_dot_dirB;
78 if ( denom == 0.0f ) {
81 tA = ( dirA_dot_trans - dirB_dot_trans * dirA_dot_dirB ) / denom;
84 else if ( tA > hlenA )
88 tB = tA * dirA_dot_dirB - dirB_dot_trans;
92 tA = tB * dirA_dot_dirB + dirA_dot_trans;
96 else if ( tA > hlenA )
98 }
else if ( tB > hlenB ) {
100 tA = tB * dirA_dot_dirB + dirA_dot_trans;
104 else if ( tA > hlenA )
113 ptsVector = translation - offsetA + offsetB;
137 btVector3 translation = translationB - translationA;
147 directionA, capsuleLengthA, directionB, capsuleLengthB );
149 btScalar distance = ptsVector.
length() - capsuleRadiusA - capsuleRadiusB;
151 if ( distance > distanceThreshold )
165 pointOnB = transformB.
getOrigin()+offsetB + normalOnB * capsuleRadiusB;
201 #ifdef USE_SEPDISTANCE_UTIL2
202 m_sepDistance((static_cast<
btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
203 (static_cast<
btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc()),
261 btVector3 endPtOrg = pointInWorld + normalOnBInWorld*orgDepth;
263 newDepth = (endPt - pointInWorld).
dot(normalOnBInWorld);
264 startPt = endPt+normalOnBInWorld*newDepth;
267 endPt = pointInWorld + normalOnBInWorld*orgDepth;
269 newDepth = (endPt - startPt).
dot(normalOnBInWorld);
274 #ifdef DEBUG_CONTACTS
278 #endif //DEBUG_CONTACTS
312 #ifndef BT_DISABLE_CAPSULE_CAPSULE_COLLIDER
334 #endif //BT_DISABLE_CAPSULE_CAPSULE_COLLIDER
339 #ifdef USE_SEPDISTANCE_UTIL2
342 m_sepDistance.updateSeparatingDistance(body0->getWorldTransform(),body1->getWorldTransform());
358 #ifdef USE_SEPDISTANCE_UTIL2
363 #endif //USE_SEPDISTANCE_UTIL2
383 #ifdef USE_SEPDISTANCE_UTIL2
395 #endif //USE_SEPDISTANCE_UTIL2
403 virtual void setShapeIdentifiersA(
int partId0,
int index0){}
404 virtual void setShapeIdentifiersB(
int partId1,
int index1){}
421 :m_originalResult(result),
422 m_marginOnA(marginOnA),
423 m_marginOnB(marginOnB),
428 virtual void setShapeIdentifiersA(
int partId0,
int index0){}
429 virtual void setShapeIdentifiersB(
int partId1,
int index1){}
432 m_reportedDistance = depthOrg;
433 m_reportedNormalOnWorld = normalOnBInWorld;
435 btVector3 adjustedPointB = pointInWorldOrg - normalOnBInWorld*m_marginOnB;
436 m_reportedDistance = depthOrg+(m_marginOnA+m_marginOnB);
437 if (m_reportedDistance<0.f)
439 m_foundResult =
true;
441 m_originalResult->addContactPoint(normalOnBInWorld,adjustedPointB,m_reportedDistance);
453 btWithoutMarginResult withoutMargin(resultOut, min0Margin,min1Margin);
467 bool foundSepAxis =
true;
475 sepNormalWorldSpace,*resultOut);
490 sepNormalWorldSpace = withoutMargin.m_reportedNormalOnWorld;
492 minDist = withoutMargin.m_reportedDistance;
497 foundSepAxis = withoutMargin.m_foundResult && minDist<0;
537 bool foundSepAxis =
false;
545 sepNormalWorldSpace,*resultOut);
572 body0Wrap->
getWorldTransform(), vertices, minDist-threshold, maxDist, *resultOut);
609 bool perturbeA =
true;
614 if (radiusA < radiusB)
623 if ( perturbeAngle > angleLimit )
624 perturbeAngle = angleLimit;
648 #ifdef DEBUG_CONTACTS
650 #endif //DEBUG_CONTACTS
655 #ifdef DEBUG_CONTACTS
669 #ifdef USE_SEPDISTANCE_UTIL2
672 m_sepDistance.initSeparatingDistance(gjkPairDetector.
getCachedSeparatingAxis(),sepDist,body0->getWorldTransform(),body1->getWorldTransform());
674 #endif //USE_SEPDISTANCE_UTIL2
703 if (squareMot0 < col0->getCcdSquareMotionThreshold() &&
705 return resultFraction;
741 if (resultFraction > result.m_fraction)
742 resultFraction = result.m_fraction;
774 if (resultFraction > result.m_fraction)
775 resultFraction = result.m_fraction;
780 return resultFraction;
virtual void releaseManifold(btPersistentManifold *manifold)=0
const btPersistentManifold * getPersistentManifold() const
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
void push_back(const T &_Val)
btScalar getCcdSweptSphereRadius() const
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
float dist(const Point3 &pnt0, const Point3 &pnt1)
btScalar getContactBreakingThreshold() const
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
CreateFunc(btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *pdSolver)
btScalar getCachedSeparatingDistance() const
void setMinkowskiB(const btConvexShape *minkB)
btScalar m_convexConservativeDistanceThreshold
int m_minimumPointsPerturbationThreshold
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
void setPersistentManifold(btPersistentManifold *manifoldPtr)
The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned ...
static void segmentsClosestPoints(btVector3 &ptsVector, btVector3 &offsetA, btVector3 &offsetB, btScalar &tA, btScalar &tB, const btVector3 &translation, const btVector3 &dirA, btScalar hlenA, const btVector3 &dirB, btScalar hlenB)
Specialized capsule-capsule collision algorithm has been added for Bullet 2.75 release to increase ra...
void btPlaneSpace1(const T &n, T &p, T &q)
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
void setHitFraction(btScalar hitFraction)
void refreshContactPoints()
void setMinkowskiA(const btConvexShape *minkA)
static btScalar capsuleCapsuleDistance(btVector3 &normalOnB, btVector3 &pointOnB, btScalar capsuleLengthA, btScalar capsuleRadiusA, btScalar capsuleLengthB, btScalar capsuleRadiusB, int capsuleAxisA, int capsuleAxisB, const btTransform &transformA, const btTransform &transformB, btScalar distanceThreshold)
#define SIMD_FORCE_INLINE
The btSphereShape implements an implicit sphere, centered around a local origin with radius...
btPersistentManifold * m_manifoldPtr
btScalar getRadius() const
bool m_useConvexConservativeDistanceUtil
btManifoldResult is a helper class to manage contact results.
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
class btIDebugDraw * m_debugDraw
btSimplexSolverInterface * m_simplexSolver
btDispatcher * m_dispatcher
btSimplexSolverInterface * m_simplexSolver
btScalar getCcdSquareMotionThreshold() const
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
const btTransform & getInterpolationWorldTransform() const
GjkConvexCast performs a raycast on a convex object using support mapping.
const btVector3 & getCachedSeparatingAxis() const
void setLowLevelOfDetail(bool useLowLevel)
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
virtual bool calcTimeOfImpact(const btTransform &fromA, const btTransform &toA, const btTransform &fromB, const btTransform &toB, CastResult &result)
cast a convex against another convex object
btTransform & getWorldTransform()
RayResult stores the closest result alternatively, add a callback method to decide about closest/all ...
#define btSimplexSolverInterface
btVoronoiSimplexSolver is an implementation of the closest point distance algorithm from a 1-4 points...
const btConvexPolyhedron * getConvexPolyhedron() const
virtual bool initializePolyhedralFeatures(int shiftVerticesByMargin=0)
optional method mainly used to generate multiple contact points by clipping polyhedral features (face...
virtual ~btConvexConvexAlgorithm()
btScalar gContactBreakingThreshold
const btTransform & getWorldTransform() const
btCollisionObject can be used to manage collision detection objects.
The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
btScalar length() const
Return the length of the vector.
virtual btPersistentManifold * getNewManifold(const btCollisionObject *b0, const btCollisionObject *b1)=0
virtual btScalar getMargin() const =0
const btCollisionShape * getCollisionShape() const
virtual btScalar getAngularMotionDisc() const
getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of...
btScalar getHitFraction() const
btVector3 can be used to represent 3D points and vectors.
btScalar length2() const
Return the length of the vector squared.
bool isPolyhedral() const
virtual btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
virtual void drawTransform(const btTransform &transform, btScalar orthoLen)
int getNumContacts() const
int m_numPerturbationIterations
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
btConvexPenetrationDepthSolver * m_pdSolver
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
btScalar getHalfHeight() const
const btCollisionShape * getCollisionShape() const
virtual void drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color)
int m_minimumPointsPerturbationThreshold
btConvexPenetrationDepthSolver * m_pdSolver
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btConvexConvexAlgorithm(btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold)
cache separating vector to speedup collision detection
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
const btCollisionObject * getCollisionObject() const
void setIgnoreMargin(bool ignoreMargin)
don't use setIgnoreMargin, it's for Bullet's internal use
int m_numPerturbationIterations