Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
58 return ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
82 if (normalInWorldSpace)
98 return ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
114 return direction - (
btScalar(2.0) * direction.
dot(normal)) * normal;
123 return normal * magnitude;
194 bool penetration =
false;
311 int numPenetrationLoops = 0;
315 numPenetrationLoops++;
317 if (numPenetrationLoops > 4)
371 if (normalMag != 0.0)
373 btVector3 perpComponent = perpindicularDir *
btScalar(normalMag * movementLength);
402 while (fraction >
btScalar(0.01) && maxIter-- > 0)
443 distance2 = currentDir.
length2();
469 bool runonce =
false;
547 if (downVelocity2 > 0.0 && downVelocity2 < stepHeight && has_hit ==
true && runonce ==
false && (
m_wasOnGround || !
m_wasJumping))
553 downVelocity = stepHeight;
838 int numPenetrationLoops = 0;
842 numPenetrationLoops++;
844 if (numPenetrationLoops > 4)
884 currently no jumping.
886 m_rigidBody->getMotionState()->getWorldTransform (xform);
890 m_rigidBody->applyCentralImpulse (up * magnitude);
941 return sUpAxisDirection;
int m_collisionFilterMask
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)=0
btCollisionObject can be used to manage collision detection objects.
btVector3 m_currentPosition
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
bool recoverFromPenetration(btCollisionWorld *collisionWorld)
btVector3 m_normalizedDirection
ClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld)
virtual btScalar addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btScalar length() const
Return the length of the vector.
virtual const btVector3 & getAngularVelocity() const
Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman,...
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar getMaxPenetrationDepth() const
void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb's default implementation is brute force, expected derived classes to implement a fast dedicat...
void setMaxPenetrationDepth(btScalar d)
btBroadphasePairArray & getOverlappingPairArray()
btVector3 m_walkDirection
this is the desired walk direction, set by the user
btVector3 m_normalWorldOnB
btQuaternion inverse() const
Return the inverse of this quaternion.
const btCollisionObject * getBody0() const
virtual void setVelocityForTimeInterval(const btVector3 &velocity, btScalar timeInterval)
Caller provides a velocity with which the character should move for the given time period.
btScalar m_angularDamping
btKinematicCharacterController(btPairCachingGhostObject *ghostObject, btConvexShape *convexShape, btScalar stepHeight, const btVector3 &up=btVector3(1.0, 0.0, 0.0))
void convexSweepTest(const btConvexShape *castShape, const btTransform &from, const btTransform &to, ConvexResultCallback &resultCallback, btScalar allowedCcdPenetration=btScalar(0.)) const
convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultC...
btScalar m_verticalOffset
btQuaternion shortestArcQuatNormalize2(btVector3 &v0, btVector3 &v1)
btScalar dot(const btVector3 &v) const
Return the dot product.
int getNumContacts() const
void setMaxJumpHeight(btScalar maxJumpHeight)
void jump(const btVector3 &v=btVector3(0, 0, 0))
btManifoldArray m_manifoldArray
keep track of the contact manifolds
btPairCachingGhostObject * m_ghostObject
void setFallSpeed(btScalar fallSpeed)
btScalar getDistance() const
const btBroadphaseInterface * getBroadphase() const
int m_collisionFilterGroup
void setInterpolate3(const btVector3 &v0, const btVector3 &v1, btScalar rt)
btHashedOverlappingPairCache * getOverlappingPairCache()
virtual void setWalkDirection(const btVector3 &walkDirection)
This should probably be called setPositionIncrementPerSimulatorStep.
btScalar btAcos(btScalar x)
int m_collisionFilterGroup
virtual void setMargin(btScalar margin)=0
btScalar m_maxSlopeCosine
btVector3 m_hitNormalLocal
btTransform & getWorldTransform()
void setStepHeight(btScalar h)
void setMaxSlope(btScalar slopeRadians)
The max slope determines the maximum angle that the controller can walk up.
void preStep(btCollisionWorld *collisionWorld)
btScalar btSin(btScalar x)
btConvexShape * m_convexShape
btScalar btFabs(btScalar x)
btVector3 m_hitPointWorld
bool m_useGhostObjectSweepTest
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
ManifoldContactPoint collects and maintains persistent contactpoints.
const btCollisionObject * m_collisionObject
btScalar getMaxSlope() const
int getNumOverlappingPairs() const
virtual btScalar getMargin() const =0
virtual bool needsCollision(const btCollisionObject *body0, const btCollisionObject *body1)
void resize(int newsize, const T &fillData=T())
btQuaternion m_targetOrientation
btVector3 getGravity() const
btScalar btRadians(btScalar x)
void setJumpSpeed(btScalar jumpSpeed)
btBroadphaseProxy * m_pProxy1
const btCollisionObject * m_hitCollisionObject
btBroadphaseProxy * getBroadphaseHandle()
btScalar btCos(btScalar x)
const btCollisionObject * m_hitCollisionObject
void setWorldTransform(const btTransform &worldTrans)
btPairCachingGhostObject * getGhostObject()
btCollisionAlgorithm * m_algorithm
btScalar m_allowedCcdPenetration
btVector3 can be used to represent 3D points and vectors.
void convexSweepTest(const class btConvexShape *castShape, const btTransform &convexFromWorld, const btTransform &convexToWorld, btCollisionWorld::ConvexResultCallback &resultCallback, btScalar allowedCcdPenetration=0.f) const
void playerStep(btCollisionWorld *collisionWorld, btScalar dt)
btBroadphaseProxy * m_pProxy0
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
ClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld)
bool hasContactResponse() const
void updateTargetPositionBasedOnCollision(const btVector3 &hit_normal, btScalar tangentMag=btScalar(0.0), btScalar normalMag=btScalar(1.0))
static btVector3 getNormalizedVector(const btVector3 &v)
btKinematicClosestNotMeConvexResultCallback(btCollisionObject *me, const btVector3 &up, btScalar minSlopeDot)
virtual void setAngularVelocity(const btVector3 &velocity)
int m_collisionFilterMask
virtual void * removeOverlappingPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1, btDispatcher *dispatcher)
btScalar m_currentStepOffset
void setGravity(const btVector3 &gravity)
const btScalar & getY() const
Return the y value.
~btKinematicCharacterController()
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
void warp(const btVector3 &origin)
static btVector3 * getUpAxisDirections()
void setUp(const btVector3 &up)
void reset(btCollisionWorld *collisionWorld)
void debugDraw(btIDebugDraw *debugDrawer)
btActionInterface interface
virtual void dispatchAllCollisionPairs(btOverlappingPairCache *pairCache, const btDispatcherInfo &dispatchInfo, btDispatcher *dispatcher)=0
btScalar m_maxPenetrationDepth
btScalar m_maxSlopeRadians
virtual btVector3 getLinearVelocity() const
btVector3 computeReflectionDirection(const btVector3 &direction, const btVector3 &normal)
btKinematicClosestNotMeRayResultCallback(btCollisionObject *me)
btScalar m_closestHitFraction
const btManifoldPoint & getContactPoint(int index) const
CollisionWorld is interface and container for the collision detection.
void stepUp(btCollisionWorld *collisionWorld)
virtual void setLinearVelocity(const btVector3 &velocity)
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)=0
btDispatcher * getDispatcher()
btScalar m_velocityTimeInterval
btVector3 perpindicularComponent(const btVector3 &direction, const btVector3 &normal)
void stepDown(btCollisionWorld *collisionWorld, btScalar dt)
btScalar btPow(btScalar x, btScalar y)
void setUpInterpolate(bool value)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
void stepForwardAndStrafe(btCollisionWorld *collisionWorld, const btVector3 &walkMove)
btQuaternion getRotation(btVector3 &v0, btVector3 &v1) const
btVector3 normalized() const
Return a normalized version of this vector.
btVector3 m_hitNormalWorld
btDispatcherInfo & getDispatchInfo()
btScalar m_verticalVelocity
The btBroadphasePair class contains a pair of aabb-overlapping objects.
btVector3 m_targetPosition
btQuaternion m_currentOrientation
int size() const
return the number of elements in the array
void setUpVector(const btVector3 &up)
btScalar length2() const
Return the length of the vector squared.
btVector3 parallelComponent(const btVector3 &direction, const btVector3 &normal)