27 : m_simplexSolver(simplexSolver),
28 m_penetrationDepthSolver(penetrationDepthSolver),
37 m_penetrationDepthSolver(0),
46 #define MAX_ITERATIONS 64 56 input.m_transformB = transB;
57 gjk.getClosestPoints(input, pointCollector, 0);
70 convexInPlaneTrans = transB.
inverse() * convexWorldTransform;
72 planeInConvex = convexWorldTransform.
inverse() * transB;
76 btVector3 vtxInPlane = convexInPlaneTrans(vtx);
77 btScalar distance = (planeNormal.
dot(vtxInPlane) - planeConstant);
79 btVector3 vtxInPlaneProjected = vtxInPlane - distance * planeNormal;
80 btVector3 vtxInPlaneWorld = transB * vtxInPlaneProjected;
98 btVector3 linVelA, angVelA, linVelB, angVelB;
105 btScalar maxAngularProjectedVelocity = angVelA.
length() * boundingRadiusA + angVelB.
length() * boundingRadiusB;
106 btVector3 relLinVel = (linVelB - linVelA);
110 if ((relLinVelocLength + maxAngularProjectedVelocity) == 0.f)
117 bool hasResult =
false;
143 btScalar projectedLinearVelocity = relLinVel.
dot(n);
144 if ((projectedLinearVelocity + maxAngularProjectedVelocity) <=
SIMD_EPSILON)
148 while (dist > radius)
156 projectedLinearVelocity = relLinVel.
dot(n);
159 if ((projectedLinearVelocity + maxAngularProjectedVelocity) <=
SIMD_EPSILON)
162 dLambda = dist / (projectedLinearVelocity + maxAngularProjectedVelocity);
170 if (lambda <= lastLambda)
179 btTransform interpolatedTransA, interpolatedTransB, relativeTrans;
183 relativeTrans = interpolatedTransB.
inverseTimes(interpolatedTransA);
void computeClosestPoints(const btTransform &transA, const btTransform &transB, struct btPointCollector &pointCollector)
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const =0
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
const btScalar & getPlaneConstant() const
#define MAX_ITERATIONS
This maximum should not be necessary.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
btScalar m_allowedPenetration
virtual void DebugDraw(btScalar fraction)
btIDebugDraw * m_debugDrawer
RayResult stores the closest result alternatively, add a callback method to decide about closest/all ...
#define btSimplexSolverInterface
btSimplexSolverInterface * m_simplexSolver
btScalar dot(const btVector3 &v) const
Return the dot product.
const btConvexShape * m_convexA
virtual btScalar getMargin() const =0
btConvexPenetrationDepthSolver * m_penetrationDepthSolver
btVector3 can be used to represent 3D points and vectors.
const btVector3 & getPlaneNormal() const
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
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
const btConvexShape * m_convexB1
virtual btScalar getAngularMotionDisc() const
getAngularMotionDisc returns the maximum radius needed for Conservative Advancement to handle time-of...
btContinuousConvexCollision(const btConvexShape *shapeA, const btConvexShape *shapeB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver)
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane. ...
virtual void drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color)
virtual void reportFailure(int errNo, int numIterations)
btVector3 m_normalOnBInWorld
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar length() const
Return the length of the vector.
const btStaticPlaneShape * m_planeShape