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;
199 #ifdef USE_SEPDISTANCE_UTIL2
200 m_sepDistance((static_cast<
btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
201 (static_cast<
btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc()),
239 :m_originalManifoldResult(originalResult),
240 m_transformA(transformA),
241 m_transformB(transformB),
242 m_unPerturbedTransform(unPerturbedTransform),
243 m_perturbA(perturbA),
244 m_debugDrawer(debugDrawer)
259 btVector3 endPtOrg = pointInWorld + normalOnBInWorld*orgDepth;
260 endPt = (m_unPerturbedTransform*m_transformA.
inverse())(endPtOrg);
261 newDepth = (endPt - pointInWorld).
dot(normalOnBInWorld);
262 startPt = endPt+normalOnBInWorld*newDepth;
265 endPt = pointInWorld + normalOnBInWorld*orgDepth;
266 startPt = (m_unPerturbedTransform*m_transformB.
inverse())(pointInWorld);
267 newDepth = (endPt - startPt).
dot(normalOnBInWorld);
272 #ifdef DEBUG_CONTACTS 276 #endif //DEBUG_CONTACTS 279 m_originalManifoldResult->
addContactPoint(normalOnBInWorld,startPt,newDepth);
310 #ifndef BT_DISABLE_CAPSULE_CAPSULE_COLLIDER 376 #endif //BT_DISABLE_CAPSULE_CAPSULE_COLLIDER 381 #ifdef USE_SEPDISTANCE_UTIL2 384 m_sepDistance.updateSeparatingDistance(body0->getWorldTransform(),body1->getWorldTransform());
400 #ifdef USE_SEPDISTANCE_UTIL2 405 #endif //USE_SEPDISTANCE_UTIL2 425 #ifdef USE_SEPDISTANCE_UTIL2 437 #endif //USE_SEPDISTANCE_UTIL2 445 virtual void setShapeIdentifiersA(
int partId0,
int index0){}
446 virtual void setShapeIdentifiersB(
int partId1,
int index1){}
463 :m_originalResult(result),
464 m_marginOnA(marginOnA),
465 m_marginOnB(marginOnB),
470 virtual void setShapeIdentifiersA(
int partId0,
int index0){}
471 virtual void setShapeIdentifiersB(
int partId1,
int index1){}
474 m_reportedDistance = depthOrg;
475 m_reportedNormalOnWorld = normalOnBInWorld;
477 btVector3 adjustedPointB = pointInWorldOrg - normalOnBInWorld*m_marginOnB;
478 m_reportedDistance = depthOrg+(m_marginOnA+m_marginOnB);
479 if (m_reportedDistance<0.f)
481 m_foundResult =
true;
483 m_originalResult->
addContactPoint(normalOnBInWorld,adjustedPointB,m_reportedDistance);
495 btWithoutMarginResult withoutMargin(resultOut, min0Margin,min1Margin);
509 bool foundSepAxis =
true;
517 sepNormalWorldSpace,*resultOut);
532 sepNormalWorldSpace = withoutMargin.m_reportedNormalOnWorld;
534 minDist = withoutMargin.m_reportedDistance;
539 foundSepAxis = withoutMargin.m_foundResult && minDist<0;
581 bool foundSepAxis =
false;
589 sepNormalWorldSpace,*resultOut);
654 bool perturbeA =
true;
659 if (radiusA < radiusB)
668 if ( perturbeAngle > angleLimit )
669 perturbeAngle = angleLimit;
693 #ifdef DEBUG_CONTACTS 695 #endif //DEBUG_CONTACTS 700 #ifdef DEBUG_CONTACTS 714 #ifdef USE_SEPDISTANCE_UTIL2 717 m_sepDistance.initSeparatingDistance(gjkPairDetector.
getCachedSeparatingAxis(),sepDist,body0->getWorldTransform(),body1->getWorldTransform());
719 #endif //USE_SEPDISTANCE_UTIL2 748 if (squareMot0 < col0->getCcdSquareMotionThreshold() &&
750 return resultFraction;
786 if (resultFraction > result.m_fraction)
787 resultFraction = result.m_fraction;
819 if (resultFraction > result.m_fraction)
820 resultFraction = result.m_fraction;
825 return resultFraction;
virtual void releaseManifold(btPersistentManifold *manifold)=0
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
void push_back(const T &_Val)
btScalar getContactBreakingThreshold() const
btScalar getCachedSeparatingDistance() const
btScalar getRadius() const
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
void setMinkowskiB(const btConvexShape *minkB)
btScalar length2() const
Return the length of the vector squared.
btScalar m_convexConservativeDistanceThreshold
int m_minimumPointsPerturbationThreshold
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
void setPersistentManifold(btPersistentManifold *manifoldPtr)
int getNumContacts() const
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
bool m_useConvexConservativeDistanceUtil
btManifoldResult is a helper class to manage contact results.
class btIDebugDraw * m_debugDraw
btConvexConvexAlgorithm(btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, btConvexPenetrationDepthSolver *pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold)
cache separating vector to speedup collision detection
const btCollisionShape * getCollisionShape() const
btDispatcher * m_dispatcher
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
GjkConvexCast performs a raycast on a convex object using support mapping.
void setLowLevelOfDetail(bool useLowLevel)
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
const btVector3 & getCachedSeparatingAxis() const
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()
btScalar getHalfHeight() const
RayResult stores the closest result alternatively, add a callback method to decide about closest/all ...
btScalar m_closestPointDistanceThreshold
btVoronoiSimplexSolver is an implementation of the closest point distance algorithm from a 1-4 points...
btScalar getCcdSquareMotionThreshold() const
btScalar getRadius() const
const btCollisionObject * getCollisionObject() 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
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...
const btTransform & getInterpolationWorldTransform() const
virtual btPersistentManifold * getNewManifold(const btCollisionObject *b0, const btCollisionObject *b1)=0
CreateFunc(btConvexPenetrationDepthSolver *pdSolver)
virtual btScalar getMargin() const =0
btVector3 can be used to represent 3D points and vectors.
bool isPolyhedral() const
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)=0
virtual btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btScalar getHitFraction() const
virtual void drawTransform(const btTransform &transform, btScalar orthoLen)
void resize(int newsize, const T &fillData=T())
btVertexArray worldVertsB1
const btTransform & getWorldTransform() const
int m_numPerturbationIterations
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
btVertexArray worldVertsB2
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.
virtual btScalar getAngularMotionDisc() const
getAngularMotionDisc returns the maximum radius needed for Conservative Advancement to handle time-of...
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 getCcdSweptSphereRadius() const
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
const btPersistentManifold * getPersistentManifold() const
virtual void drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color)
int m_minimumPointsPerturbationThreshold
const btConvexPolyhedron * getConvexPolyhedron() const
btConvexPenetrationDepthSolver * m_pdSolver
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
const btCollisionShape * getCollisionShape() const
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
btScalar length() const
Return the length of the vector.
void setIgnoreMargin(bool ignoreMargin)
don't use setIgnoreMargin, it's for Bullet's internal use
int m_numPerturbationIterations