59 return ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace);
85 if (normalInWorldSpace)
99 return ClosestConvexResultCallback::addSingleResult (convexResult, normalInWorldSpace);
114 return direction - (
btScalar(2.0) * direction.
dot(normal)) * normal;
123 return normal * magnitude;
186 bool penetration =
false;
314 if (normalMag != 0.0)
316 btVector3 perpComponent = perpindicularDir *
btScalar (normalMag*movementLength);
352 while (fraction >
btScalar(0.01) && maxIter-- > 0)
390 distance2 = currentDir.
length2();
419 bool runonce =
false;
432 if(downVelocity > 0.0 && downVelocity >
m_fallSpeed
481 bool has_hit =
false;
485 has_hit = callback2.
hasHit();
487 if(downVelocity2 > 0.0 && downVelocity2 <
m_stepHeight && has_hit ==
true && runonce ==
false
504 if (callback.
hasHit() || runonce ==
true)
557 m_useWalkDirection =
true;
558 m_walkDirection = walkDirection;
575 m_useWalkDirection =
false;
576 m_walkDirection = velocity;
578 m_velocityTimeInterval += timeInterval;
610 int numPenetrationLoops = 0;
614 numPenetrationLoops++;
616 if (numPenetrationLoops > 4)
719 currently no jumping.
721 m_rigidBody->getMotionState()->getWorldTransform (xform);
725 m_rigidBody->applyCentralImpulse (up * magnitude);
760 return sUpAxisDirection;
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
void playerStep(btCollisionWorld *collisionWorld, btScalar dt)
btPairCachingGhostObject * m_ghostObject
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace)
void stepDown(btCollisionWorld *collisionWorld, btScalar dt)
btKinematicClosestNotMeRayResultCallback(btCollisionObject *me)
~btKinematicCharacterController()
btScalar btRadians(btScalar x)
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
btScalar m_velocityTimeInterval
float dist(const Point3 &pnt0, const Point3 &pnt1)
void setJumpSpeed(btScalar jumpSpeed)
short int m_collisionFilterGroup
short int m_collisionFilterGroup
virtual void dispatchAllCollisionPairs(btOverlappingPairCache *pairCache, const btDispatcherInfo &dispatchInfo, btDispatcher *dispatcher)=0
btVector3 computeReflectionDirection(const btVector3 &direction, const btVector3 &normal)
btKinematicCharacterController(btPairCachingGhostObject *ghostObject, btConvexShape *convexShape, btScalar stepHeight, int upAxis=1)
btBroadphasePairArray & getOverlappingPairArray()
btScalar m_maxSlopeRadians
ManifoldContactPoint collects and maintains persistent contactpoints.
const btCollisionObject * getBody0() const
btVector3 m_normalizedDirection
btScalar getGravity() const
btScalar m_maxSlopeCosine
btVector3 m_hitPointWorld
virtual void setVelocityForTimeInterval(const btVector3 &velocity, btScalar timeInterval)
Caller provides a velocity with which the character should move for the given time period...
void debugDraw(btIDebugDraw *debugDrawer)
btActionInterface interface
btScalar dot(const btVector3 &v) const
Return the dot product.
bool hasContactResponse() const
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
btScalar m_verticalVelocity
btHashedOverlappingPairCache * getOverlappingPairCache()
const btCollisionObject * m_hitCollisionObject
btTransform & getWorldTransform()
btVector3 m_normalWorldOnB
btVector3 m_touchingNormal
btScalar m_currentStepOffset
int size() const
return the number of elements in the array
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...
btBroadphaseProxy * getBroadphaseHandle()
static btVector3 getNormalizedVector(const btVector3 &v)
bool m_useGhostObjectSweepTest
btVector3 m_hitNormalLocal
int getNumOverlappingPairs() const
ClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld)
void setMaxSlope(btScalar slopeRadians)
The max slope determines the maximum angle that the controller can walk up.
const btScalar & getY() const
Return the y value.
btCollisionObject can be used to manage collision detection objects.
bool recoverFromPenetration(btCollisionWorld *collisionWorld)
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
void setFallSpeed(btScalar fallSpeed)
btVector3 m_hitNormalWorld
btScalar length() const
Return the length of the vector.
const btCollisionObject * m_collisionObject
btVector3 m_currentPosition
const btManifoldPoint & getContactPoint(int index) const
void setWorldTransform(const btTransform &worldTrans)
btDispatcher * getDispatcher()
virtual btScalar getMargin() const =0
btVector3 parallelComponent(const btVector3 &direction, const btVector3 &normal)
short int m_collisionFilterMask
btConvexShape * m_convexShape
btBroadphaseProxy * m_pProxy1
btCollisionAlgorithm * m_algorithm
void warp(const btVector3 &origin)
virtual btScalar addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace)
btVector3 can be used to represent 3D points and vectors.
btManifoldArray m_manifoldArray
keep track of the contact manifolds
virtual void * removeOverlappingPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1, btDispatcher *dispatcher)
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)=0
btScalar length2() const
Return the length of the vector squared.
btVector3 m_walkDirection
this is the desired walk direction, set by the user
btBroadphaseProxy * m_pProxy0
const btBroadphaseInterface * getBroadphase() const
void updateTargetPositionBasedOnCollision(const btVector3 &hit_normal, btScalar tangentMag=btScalar(0.0), btScalar normalMag=btScalar(1.0))
btVector3 m_targetPosition
btScalar getMaxSlope() const
btScalar m_verticalOffset
CollisionWorld is interface and container for the collision detection.
btDispatcherInfo & getDispatchInfo()
btPairCachingGhostObject * getGhostObject()
void stepUp(btCollisionWorld *collisionWorld)
btVector3 normalized() const
Return a normalized version of this vector.
btScalar m_allowedCcdPenetration
void resize(int newsize, const T &fillData=T())
int getNumContacts() const
btVector3 perpindicularComponent(const btVector3 &direction, const btVector3 &normal)
void reset(btCollisionWorld *collisionWorld)
void setGravity(btScalar gravity)
void convexSweepTest(const class btConvexShape *castShape, const btTransform &convexFromWorld, const btTransform &convexToWorld, btCollisionWorld::ConvexResultCallback &resultCallback, btScalar allowedCcdPenetration=0.f) const
btScalar m_closestHitFraction
btKinematicClosestNotMeConvexResultCallback(btCollisionObject *me, const btVector3 &up, btScalar minSlopeDot)
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)=0
short int m_collisionFilterMask
void stepForwardAndStrafe(btCollisionWorld *collisionWorld, const btVector3 &walkMove)
void preStep(btCollisionWorld *collisionWorld)
virtual void setWalkDirection(const btVector3 &walkDirection)
This should probably be called setPositionIncrementPerSimulatorStep.
virtual void setMargin(btScalar margin)=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...
void setUpInterpolate(bool value)
btScalar getDistance() const
void setMaxJumpHeight(btScalar maxJumpHeight)
void setInterpolate3(const btVector3 &v0, const btVector3 &v1, btScalar rt)
static btVector3 * getUpAxisDirections()
Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman...
ClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btCos(btScalar x)
btScalar btFabs(btScalar x)
The btBroadphasePair class contains a pair of aabb-overlapping objects.