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