28 m_isSwapped(isSwapped)
73 if (
getSphereDistance(boxObjWrap, pOnBox, normalOnSurfaceB, penetrationDepth, sphereCenter, radius, maxContactDistance))
106 penetrationDepth = 1.0f;
121 btScalar intersectionDist = fRadius + boxMargin;
122 btScalar contactDist = intersectionDist + maxContactDistance;
123 normal = sphereRelPos - closestPoint;
127 if (dist2 > contactDist * contactDist)
141 distance = normal.
length();
145 pointOnBox = closestPoint + normal * boxMargin;
147 penetrationDepth = distance - intersectionDist;
165 closestPoint.
setX( boxHalfExtent.
getX() );
168 faceDist = boxHalfExtent.
getX() + sphereRelPos.
getX();
169 if (faceDist < minDist)
172 closestPoint = sphereRelPos;
173 closestPoint.
setX( -boxHalfExtent.
getX() );
177 faceDist = boxHalfExtent.
getY() - sphereRelPos.
getY();
178 if (faceDist < minDist)
181 closestPoint = sphereRelPos;
182 closestPoint.
setY( boxHalfExtent.
getY() );
186 faceDist = boxHalfExtent.
getY() + sphereRelPos.
getY();
187 if (faceDist < minDist)
190 closestPoint = sphereRelPos;
191 closestPoint.
setY( -boxHalfExtent.
getY() );
195 faceDist = boxHalfExtent.
getZ() - sphereRelPos.
getZ();
196 if (faceDist < minDist)
199 closestPoint = sphereRelPos;
200 closestPoint.
setZ( boxHalfExtent.
getZ() );
204 faceDist = boxHalfExtent.
getZ() + sphereRelPos.
getZ();
205 if (faceDist < minDist)
208 closestPoint = sphereRelPos;
209 closestPoint.
setZ( -boxHalfExtent.
getZ() );
virtual void releaseManifold(btPersistentManifold *manifold)=0
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
btScalar getContactBreakingThreshold() const
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
btSphereBoxCollisionAlgorithm(btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
btScalar length2() const
Return the length of the vector squared.
void setZ(btScalar _z)
Set the z value.
void setPersistentManifold(btPersistentManifold *manifoldPtr)
int getNumContacts() const
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
void refreshContactPoints()
const btScalar & getY() const
Return the y value.
The btSphereShape implements an implicit sphere, centered around a local origin with radius...
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btManifoldResult is a helper class to manage contact results.
const btCollisionShape * getCollisionShape() const
btDispatcher * m_dispatcher
virtual ~btSphereBoxCollisionAlgorithm()
const btScalar & getZ() const
Return the z value.
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
void setX(btScalar _x)
Set the x value.
bool getSphereDistance(const btCollisionObjectWrapper *boxObjWrap, btVector3 &v3PointOnBox, btVector3 &normal, btScalar &penetrationDepth, const btVector3 &v3SphereCenter, btScalar fRadius, btScalar maxContactDistance)
btScalar getSpherePenetration(btVector3 const &boxHalfExtent, btVector3 const &sphereRelPos, btVector3 &closestPoint, btVector3 &normal)
virtual btScalar getMargin() const
btScalar getRadius() const
const btCollisionObject * getCollisionObject() const
void setY(btScalar _y)
Set the y value.
btCollisionObject can be used to manage collision detection objects.
virtual btPersistentManifold * getNewManifold(const btCollisionObject *b0, const btCollisionObject *b1)=0
The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by ...
btVector3 can be used to represent 3D points and vectors.
const btTransform & getWorldTransform() const
const T & btMax(const T &a, const T &b)
const btVector3 & getHalfExtentsWithoutMargin() const
virtual bool needsCollision(const btCollisionObject *body0, const btCollisionObject *body1)=0
virtual btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
const T & btMin(const T &a, const T &b)
btPersistentManifold * m_manifoldPtr
const btScalar & getX() const
Return the x value.
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.