Bullet Collision Detection & Physics Library
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
btKinematicCharacterController Class Reference

btKinematicCharacterController is an object that supports a sliding motion in a world. More...

#include <btKinematicCharacterController.h>

Inheritance diagram for btKinematicCharacterController:
Inheritance graph
Collaboration diagram for btKinematicCharacterController:
Collaboration graph

Public Member Functions

 btKinematicCharacterController (btPairCachingGhostObject *ghostObject, btConvexShape *convexShape, btScalar stepHeight, int upAxis=1)
 ~btKinematicCharacterController ()
virtual void updateAction (btCollisionWorld *collisionWorld, btScalar deltaTime)
 btActionInterface interface More...
void debugDraw (btIDebugDraw *debugDrawer)
 btActionInterface interface More...
void setUpAxis (int axis)
virtual void setWalkDirection (const btVector3 &walkDirection)
 This should probably be called setPositionIncrementPerSimulatorStep. More...
virtual void setVelocityForTimeInterval (const btVector3 &velocity, btScalar timeInterval)
 Caller provides a velocity with which the character should move for the given time period. More...
void reset (btCollisionWorld *collisionWorld)
void warp (const btVector3 &origin)
void preStep (btCollisionWorld *collisionWorld)
void playerStep (btCollisionWorld *collisionWorld, btScalar dt)
void setFallSpeed (btScalar fallSpeed)
void setJumpSpeed (btScalar jumpSpeed)
void setMaxJumpHeight (btScalar maxJumpHeight)
bool canJump () const
void jump ()
void setGravity (btScalar gravity)
btScalar getGravity () const
void setMaxSlope (btScalar slopeRadians)
 The max slope determines the maximum angle that the controller can walk up. More...
btScalar getMaxSlope () const
btPairCachingGhostObjectgetGhostObject ()
void setUseGhostSweepTest (bool useGhostObjectSweepTest)
bool onGround () const
void setUpInterpolate (bool value)
- Public Member Functions inherited from btCharacterControllerInterface
 btCharacterControllerInterface ()
virtual ~btCharacterControllerInterface ()
- Public Member Functions inherited from btActionInterface
virtual ~btActionInterface ()

Protected Member Functions

btVector3 computeReflectionDirection (const btVector3 &direction, const btVector3 &normal)
btVector3 parallelComponent (const btVector3 &direction, const btVector3 &normal)
btVector3 perpindicularComponent (const btVector3 &direction, const btVector3 &normal)
bool recoverFromPenetration (btCollisionWorld *collisionWorld)
void stepUp (btCollisionWorld *collisionWorld)
void updateTargetPositionBasedOnCollision (const btVector3 &hit_normal, btScalar tangentMag=btScalar(0.0), btScalar normalMag=btScalar(1.0))
void stepForwardAndStrafe (btCollisionWorld *collisionWorld, const btVector3 &walkMove)
void stepDown (btCollisionWorld *collisionWorld, btScalar dt)

Static Protected Member Functions

static btVector3getUpAxisDirections ()
- Static Protected Member Functions inherited from btActionInterface
static btRigidBodygetFixedBody ()

Protected Attributes

btScalar m_halfHeight
btScalar m_verticalVelocity
btScalar m_verticalOffset
btScalar m_fallSpeed
btScalar m_jumpSpeed
btScalar m_maxJumpHeight
btScalar m_maxSlopeRadians
btScalar m_maxSlopeCosine
btScalar m_gravity
btScalar m_turnAngle
btScalar m_stepHeight
btScalar m_addedMargin
btVector3 m_walkDirection
 this is the desired walk direction, set by the user More...
btVector3 m_normalizedDirection
btVector3 m_currentPosition
btScalar m_currentStepOffset
btVector3 m_targetPosition
btManifoldArray m_manifoldArray
 keep track of the contact manifolds More...
bool m_touchingContact
btVector3 m_touchingNormal
bool m_wasOnGround
bool m_wasJumping
bool m_useGhostObjectSweepTest
bool m_useWalkDirection
btScalar m_velocityTimeInterval
int m_upAxis
bool m_interpolateUp
bool full_drop
bool bounce_fix

Detailed Description

btKinematicCharacterController is an object that supports a sliding motion in a world.

It uses a ghost object and convex sweep test to test for upcoming collisions. This is combined with discrete collision detection to recover from penetrations. Interaction between btKinematicCharacterController and dynamic rigid bodies needs to be explicity implemented by the user.

Definition at line 37 of file btKinematicCharacterController.h.

Constructor & Destructor Documentation

btKinematicCharacterController::btKinematicCharacterController ( btPairCachingGhostObject ghostObject,
btConvexShape convexShape,
btScalar  stepHeight,
int  upAxis = 1 

Definition at line 135 of file btKinematicCharacterController.cpp.

btKinematicCharacterController::~btKinematicCharacterController ( )

Definition at line 161 of file btKinematicCharacterController.cpp.

Member Function Documentation

btKinematicCharacterController::BT_DECLARE_ALIGNED_ALLOCATOR ( )
bool btKinematicCharacterController::canJump ( ) const
btVector3 btKinematicCharacterController::computeReflectionDirection ( const btVector3 direction,
const btVector3 normal 

Definition at line 113 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::debugDraw ( btIDebugDraw debugDrawer)

btActionInterface interface

Implements btActionInterface.

Definition at line 764 of file btKinematicCharacterController.cpp.

btPairCachingGhostObject * btKinematicCharacterController::getGhostObject ( )

Definition at line 165 of file btKinematicCharacterController.cpp.

btScalar btKinematicCharacterController::getGravity ( ) const

Definition at line 735 of file btKinematicCharacterController.cpp.

btScalar btKinematicCharacterController::getMaxSlope ( ) const

Definition at line 746 of file btKinematicCharacterController.cpp.

btVector3 * btKinematicCharacterController::getUpAxisDirections ( )

Definition at line 757 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::jump ( )
bool btKinematicCharacterController::onGround ( ) const
btVector3 btKinematicCharacterController::parallelComponent ( const btVector3 direction,
const btVector3 normal 

Definition at line 121 of file btKinematicCharacterController.cpp.

btVector3 btKinematicCharacterController::perpindicularComponent ( const btVector3 direction,
const btVector3 normal 

Definition at line 130 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::playerStep ( btCollisionWorld collisionWorld,
btScalar  dt 
void btKinematicCharacterController::preStep ( btCollisionWorld collisionWorld)
bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld collisionWorld)

Definition at line 170 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::reset ( btCollisionWorld collisionWorld)
void btKinematicCharacterController::setFallSpeed ( btScalar  fallSpeed)

Definition at line 691 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::setGravity ( btScalar  gravity)

Definition at line 730 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::setJumpSpeed ( btScalar  jumpSpeed)

Definition at line 696 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::setMaxJumpHeight ( btScalar  maxJumpHeight)

Definition at line 701 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::setMaxSlope ( btScalar  slopeRadians)

The max slope determines the maximum angle that the controller can walk up.

The slope angle is measured in radians.

Definition at line 740 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::setUpAxis ( int  axis)

Definition at line 115 of file btKinematicCharacterController.h.

void btKinematicCharacterController::setUpInterpolate ( bool  value)
void btKinematicCharacterController::setUseGhostSweepTest ( bool  useGhostObjectSweepTest)

Definition at line 161 of file btKinematicCharacterController.h.

void btKinematicCharacterController::setVelocityForTimeInterval ( const btVector3 velocity,
btScalar  timeInterval 

Caller provides a velocity with which the character should move for the given time period.

After the time period, velocity is reset to zero. This call will reset any walk direction set by setWalkDirection(). Negative time intervals will result in no motion.

Implements btCharacterControllerInterface.

Definition at line 566 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::setWalkDirection ( const btVector3 walkDirection)

This should probably be called setPositionIncrementPerSimulatorStep.

This is neither a direction nor a velocity, but the amount to increment the position each simulation iteration, regardless of dt. This call will reset any velocity set by setVelocityForTimeInterval().

Implements btCharacterControllerInterface.

Definition at line 554 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::stepDown ( btCollisionWorld collisionWorld,
btScalar  dt 

Definition at line 417 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::stepForwardAndStrafe ( btCollisionWorld collisionWorld,
const btVector3 walkMove 

Definition at line 327 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::stepUp ( btCollisionWorld collisionWorld)

Definition at line 245 of file btKinematicCharacterController.cpp.

virtual void btKinematicCharacterController::updateAction ( btCollisionWorld collisionWorld,
btScalar  deltaTime 

btActionInterface interface

Implements btActionInterface.

Definition at line 106 of file btKinematicCharacterController.h.

void btKinematicCharacterController::updateTargetPositionBasedOnCollision ( const btVector3 hit_normal,
btScalar  tangentMag = btScalar(0.0),
btScalar  normalMag = btScalar(1.0) 

Definition at line 291 of file btKinematicCharacterController.cpp.

void btKinematicCharacterController::warp ( const btVector3 origin)

Member Data Documentation

bool btKinematicCharacterController::bounce_fix

Definition at line 86 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::full_drop

Definition at line 85 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_addedMargin

Definition at line 59 of file btKinematicCharacterController.h.

btConvexShape* btKinematicCharacterController::m_convexShape

Definition at line 44 of file btKinematicCharacterController.h.

btVector3 btKinematicCharacterController::m_currentPosition

Definition at line 66 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_currentStepOffset

Definition at line 67 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_fallSpeed

Definition at line 48 of file btKinematicCharacterController.h.

btPairCachingGhostObject* btKinematicCharacterController::m_ghostObject

Definition at line 43 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_gravity

Definition at line 53 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_halfHeight

Definition at line 41 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::m_interpolateUp

Definition at line 84 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_jumpSpeed

Definition at line 49 of file btKinematicCharacterController.h.

btManifoldArray btKinematicCharacterController::m_manifoldArray

keep track of the contact manifolds

Definition at line 71 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_maxJumpHeight

Definition at line 50 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_maxSlopeCosine

Definition at line 52 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_maxSlopeRadians

Definition at line 51 of file btKinematicCharacterController.h.

btVector3 btKinematicCharacterController::m_normalizedDirection

Definition at line 63 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_stepHeight

Definition at line 57 of file btKinematicCharacterController.h.

btVector3 btKinematicCharacterController::m_targetPosition

Definition at line 68 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::m_touchingContact

Definition at line 73 of file btKinematicCharacterController.h.

btVector3 btKinematicCharacterController::m_touchingNormal

Definition at line 74 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_turnAngle

Definition at line 55 of file btKinematicCharacterController.h.

int btKinematicCharacterController::m_upAxis

Definition at line 81 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::m_useGhostObjectSweepTest

Definition at line 78 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::m_useWalkDirection

Definition at line 79 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_velocityTimeInterval

Definition at line 80 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_verticalOffset

Definition at line 47 of file btKinematicCharacterController.h.

btScalar btKinematicCharacterController::m_verticalVelocity

Definition at line 46 of file btKinematicCharacterController.h.

btVector3 btKinematicCharacterController::m_walkDirection

this is the desired walk direction, set by the user

Definition at line 62 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::m_wasJumping

Definition at line 77 of file btKinematicCharacterController.h.

bool btKinematicCharacterController::m_wasOnGround

Definition at line 76 of file btKinematicCharacterController.h.

The documentation for this class was generated from the following files: