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
200m_sepDistance((static_cast<
btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
201 (static_cast<
btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc()),
222void btConvexConvexAlgorithm ::setLowLevelOfDetail(
bool useLowLevel)
224 m_lowLevelOfDetail = useLowLevel;
247 virtual ~ btPerturbedContactResult()
259 btVector3 endPtOrg = pointInWorld + normalOnBInWorld*orgDepth;
261 newDepth = (endPt - pointInWorld).
dot(normalOnBInWorld);
262 startPt = endPt+normalOnBInWorld*newDepth;
265 endPt = pointInWorld + normalOnBInWorld*orgDepth;
267 newDepth = (endPt - startPt).
dot(normalOnBInWorld);
297 m_ownManifold =
true;
310#ifndef BT_DISABLE_CAPSULE_CAPSULE_COLLIDER
381#ifdef USE_SEPDISTANCE_UTIL2
384 m_sepDistance.updateSeparatingDistance(body0->getWorldTransform(),body1->getWorldTransform());
400#ifdef USE_SEPDISTANCE_UTIL2
425#ifdef USE_SEPDISTANCE_UTIL2
463 :m_originalResult(result),
464 m_marginOnA(marginOnA),
465 m_marginOnB(marginOnB),
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;
548 worldVertsB1.resize(0);
551 body1Wrap->
getWorldTransform(), minDist-threshold, threshold, worldVertsB1,worldVertsB2,
575 btScalar threshold = m_manifoldPtr->getContactBreakingThreshold();
581 bool foundSepAxis =
false;
589 sepNormalWorldSpace,*resultOut);
615 worldVertsB2.resize(0);
617 body0Wrap->
getWorldTransform(), vertices, worldVertsB2,minDist-threshold, maxDist, *resultOut);
654 bool perturbeA =
true;
659 if (radiusA < radiusB)
668 if ( perturbeAngle > angleLimit )
669 perturbeAngle = angleLimit;
680 for ( i=0;i<m_numPerturbationIterations;i++)
693 #ifdef DEBUG_CONTACTS
700 #ifdef DEBUG_CONTACTS
714#ifdef USE_SEPDISTANCE_UTIL2
717 m_sepDistance.initSeparatingDistance(gjkPairDetector.
getCachedSeparatingAxis(),sepDist,body0->getWorldTransform(),body1->getWorldTransform());
748 if (squareMot0 < col0->getCcdSquareMotionThreshold() &&
750 return resultFraction;
825 return resultFraction;
@ TRIANGLE_SHAPE_PROXYTYPE
@ CAPSULE_SHAPE_PROXYTYPE
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)
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...
btScalar gContactBreakingThreshold
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...
#define SIMD_FORCE_INLINE
void btPlaneSpace1(const T &n, T &p, T &q)
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
void push_back(const T &_Val)
The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned ...
btScalar getRadius() const
btScalar getHalfHeight() const
btDispatcher * m_dispatcher
btCollisionObject can be used to manage collision detection objects.
btScalar getHitFraction() const
btTransform & getWorldTransform()
const btTransform & getInterpolationWorldTransform() const
const btCollisionShape * getCollisionShape() const
void setHitFraction(btScalar hitFraction)
btScalar getCcdSquareMotionThreshold() const
btScalar getCcdSweptSphereRadius() const
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
virtual btScalar getAngularMotionDisc() const
getAngularMotionDisc returns the maximum radius needed for Conservative Advancement to handle time-of...
virtual btScalar getContactBreakingThreshold(btScalar defaultContactThresholdFactor) const
bool isPolyhedral() const
btPersistentManifold * m_manifoldPtr
virtual ~btConvexConvexAlgorithm()
btConvexPenetrationDepthSolver * m_pdSolver
virtual btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
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
int m_minimumPointsPerturbationThreshold
int m_numPerturbationIterations
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
virtual btScalar getMargin() const =0
virtual void releaseManifold(btPersistentManifold *manifold)=0
GjkConvexCast performs a raycast on a convex object using support mapping.
virtual bool calcTimeOfImpact(const btTransform &fromA, const btTransform &toA, const btTransform &fromB, const btTransform &toB, CastResult &result)
cast a convex against another convex object
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
const btVector3 & getCachedSeparatingAxis() const
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
btScalar getCachedSeparatingDistance() const
void setIgnoreMargin(bool ignoreMargin)
don't use setIgnoreMargin, it's for Bullet's internal use
void setMinkowskiA(const btConvexShape *minkA)
void setMinkowskiB(const btConvexShape *minkB)
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
virtual void drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color)
virtual void drawTransform(const btTransform &transform, btScalar orthoLen)
btManifoldResult is a helper class to manage contact results.
const btPersistentManifold * getPersistentManifold() const
void setPersistentManifold(btPersistentManifold *manifoldPtr)
btScalar m_closestPointDistanceThreshold
void refreshContactPoints()
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
int getNumContacts() const
The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
virtual bool initializePolyhedralFeatures(int shiftVerticesByMargin=0)
optional method mainly used to generate multiple contact points by clipping polyhedral features (face...
const btConvexPolyhedron * getConvexPolyhedron() const
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
The btSphereShape implements an implicit sphere, centered around a local origin with radius.
btScalar getRadius() const
btVector3 can be used to represent 3D points and vectors.
btScalar length() const
Return the length of the vector.
btScalar length2() const
Return the length of the vector squared.
btVoronoiSimplexSolver is an implementation of the closest point distance algorithm from a 1-4 points...
const btCollisionShape * getCollisionShape() const
const btCollisionObject * getCollisionObject() const
const btTransform & getWorldTransform() const
RayResult stores the closest result alternatively, add a callback method to decide about closest/all ...
CreateFunc(btConvexPenetrationDepthSolver *pdSolver)
int m_numPerturbationIterations
int m_minimumPointsPerturbationThreshold
btConvexPenetrationDepthSolver * m_pdSolver
virtual void setShapeIdentifiersA(int partId0, int index0)=0
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
virtual void setShapeIdentifiersB(int partId1, int index1)=0
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)=0
bool m_useConvexConservativeDistanceUtil
btScalar m_convexConservativeDistanceThreshold
class btIDebugDraw * m_debugDraw