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
[legend]
Collaboration diagram for btKinematicCharacterController:
Collaboration graph
[legend]

Public Member Functions

 BT_DECLARE_ALIGNED_ALLOCATOR ()
 
 btKinematicCharacterController (btPairCachingGhostObject *ghostObject, btConvexShape *convexShape, btScalar stepHeight, const btVector3 &up=btVector3(1.0, 0.0, 0.0))
 
 ~btKinematicCharacterController ()
 
virtual void updateAction (btCollisionWorld *collisionWorld, btScalar deltaTime)
 btActionInterface interface More...
 
void debugDraw (btIDebugDraw *debugDrawer)
 btActionInterface interface More...
 
void setUp (const btVector3 &up)
 
const btVector3getUp ()
 
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...
 
virtual void setAngularVelocity (const btVector3 &velocity)
 
virtual const btVector3getAngularVelocity () const
 
virtual void setLinearVelocity (const btVector3 &velocity)
 
virtual btVector3 getLinearVelocity () const
 
void setLinearDamping (btScalar d)
 
btScalar getLinearDamping () const
 
void setAngularDamping (btScalar d)
 
btScalar getAngularDamping () const
 
void reset (btCollisionWorld *collisionWorld)
 
void warp (const btVector3 &origin)
 
void preStep (btCollisionWorld *collisionWorld)
 
void playerStep (btCollisionWorld *collisionWorld, btScalar dt)
 
void setStepHeight (btScalar h)
 
btScalar getStepHeight () const
 
void setFallSpeed (btScalar fallSpeed)
 
btScalar getFallSpeed () const
 
void setJumpSpeed (btScalar jumpSpeed)
 
btScalar getJumpSpeed () const
 
void setMaxJumpHeight (btScalar maxJumpHeight)
 
bool canJump () const
 
void jump (const btVector3 &v=btVector3(0, 0, 0))
 
void applyImpulse (const btVector3 &v)
 
void setGravity (const btVector3 &gravity)
 
btVector3 getGravity () const
 
void setMaxSlope (btScalar slopeRadians)
 The max slope determines the maximum angle that the controller can walk up. More...
 
btScalar getMaxSlope () const
 
void setMaxPenetrationDepth (btScalar d)
 
btScalar getMaxPenetrationDepth () const
 
btPairCachingGhostObjectgetGhostObject ()
 
void setUseGhostSweepTest (bool useGhostObjectSweepTest)
 
bool onGround () const
 
void setUpInterpolate (bool value)
 
- Public Member Functions inherited from btCharacterControllerInterface
 btCharacterControllerInterface ()
 
virtual ~btCharacterControllerInterface ()
 
virtual void setWalkDirection (const btVector3 &walkDirection)=0
 
virtual void setVelocityForTimeInterval (const btVector3 &velocity, btScalar timeInterval)=0
 
virtual void reset (btCollisionWorld *collisionWorld)=0
 
virtual void warp (const btVector3 &origin)=0
 
virtual void preStep (btCollisionWorld *collisionWorld)=0
 
virtual void playerStep (btCollisionWorld *collisionWorld, btScalar dt)=0
 
virtual bool canJump () const =0
 
virtual void jump (const btVector3 &dir=btVector3(0, 0, 0))=0
 
virtual bool onGround () const =0
 
virtual void setUpInterpolate (bool value)=0
 
- Public Member Functions inherited from btActionInterface
virtual ~btActionInterface ()
 
virtual void updateAction (btCollisionWorld *collisionWorld, btScalar deltaTimeStep)=0
 
virtual void debugDraw (btIDebugDraw *debugDrawer)=0
 

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)
 
virtual bool needsCollision (const btCollisionObject *body0, const btCollisionObject *body1)
 
void setUpVector (const btVector3 &up)
 
btQuaternion getRotation (btVector3 &v0, btVector3 &v1) const
 

Static Protected Member Functions

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

Protected Attributes

btScalar m_halfHeight
 
btPairCachingGhostObjectm_ghostObject
 
btConvexShapem_convexShape
 
btScalar m_maxPenetrationDepth
 
btScalar m_verticalVelocity
 
btScalar m_verticalOffset
 
btScalar m_fallSpeed
 
btScalar m_jumpSpeed
 
btScalar m_SetjumpSpeed
 
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_AngVel
 
btVector3 m_jumpPosition
 
btVector3 m_currentPosition
 
btScalar m_currentStepOffset
 
btVector3 m_targetPosition
 
btQuaternion m_currentOrientation
 
btQuaternion m_targetOrientation
 
btManifoldArray m_manifoldArray
 keep track of the contact manifolds More...
 
bool m_touchingContact
 
btVector3 m_touchingNormal
 
btScalar m_linearDamping
 
btScalar m_angularDamping
 
bool m_wasOnGround
 
bool m_wasJumping
 
bool m_useGhostObjectSweepTest
 
bool m_useWalkDirection
 
btScalar m_velocityTimeInterval
 
btVector3 m_up
 
btVector3 m_jumpAxis
 
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 35 of file btKinematicCharacterController.h.

Constructor & Destructor Documentation

◆ btKinematicCharacterController()

btKinematicCharacterController::btKinematicCharacterController ( btPairCachingGhostObject ghostObject,
btConvexShape convexShape,
btScalar  stepHeight,
const btVector3 up = btVector3(1.0, 0.0, 0.0) 
)

Definition at line 134 of file btKinematicCharacterController.cpp.

◆ ~btKinematicCharacterController()

btKinematicCharacterController::~btKinematicCharacterController ( )

Definition at line 168 of file btKinematicCharacterController.cpp.

Member Function Documentation

◆ applyImpulse()

void btKinematicCharacterController::applyImpulse ( const btVector3 v)
inline

Definition at line 177 of file btKinematicCharacterController.h.

◆ BT_DECLARE_ALIGNED_ALLOCATOR()

btKinematicCharacterController::BT_DECLARE_ALIGNED_ALLOCATOR ( )

◆ canJump()

bool btKinematicCharacterController::canJump ( ) const
virtual

◆ computeReflectionDirection()

btVector3 btKinematicCharacterController::computeReflectionDirection ( const btVector3 direction,
const btVector3 normal 
)
protected

Definition at line 112 of file btKinematicCharacterController.cpp.

◆ debugDraw()

void btKinematicCharacterController::debugDraw ( btIDebugDraw debugDrawer)
virtual

btActionInterface interface

Implements btActionInterface.

Definition at line 944 of file btKinematicCharacterController.cpp.

◆ getAngularDamping()

btScalar btKinematicCharacterController::getAngularDamping ( ) const
inline

Definition at line 158 of file btKinematicCharacterController.h.

◆ getAngularVelocity()

const btVector3 & btKinematicCharacterController::getAngularVelocity ( ) const
virtual

Definition at line 638 of file btKinematicCharacterController.cpp.

◆ getFallSpeed()

btScalar btKinematicCharacterController::getFallSpeed ( ) const
inline

Definition at line 169 of file btKinematicCharacterController.h.

◆ getGhostObject()

btPairCachingGhostObject * btKinematicCharacterController::getGhostObject ( )

Definition at line 172 of file btKinematicCharacterController.cpp.

◆ getGravity()

btVector3 btKinematicCharacterController::getGravity ( ) const

Definition at line 901 of file btKinematicCharacterController.cpp.

◆ getJumpSpeed()

btScalar btKinematicCharacterController::getJumpSpeed ( ) const
inline

Definition at line 171 of file btKinematicCharacterController.h.

◆ getLinearDamping()

btScalar btKinematicCharacterController::getLinearDamping ( ) const
inline

Definition at line 156 of file btKinematicCharacterController.h.

◆ getLinearVelocity()

btVector3 btKinematicCharacterController::getLinearVelocity ( ) const
virtual

Definition at line 670 of file btKinematicCharacterController.cpp.

◆ getMaxPenetrationDepth()

btScalar btKinematicCharacterController::getMaxPenetrationDepth ( ) const

Definition at line 922 of file btKinematicCharacterController.cpp.

◆ getMaxSlope()

btScalar btKinematicCharacterController::getMaxSlope ( ) const

Definition at line 912 of file btKinematicCharacterController.cpp.

◆ getRotation()

btQuaternion btKinematicCharacterController::getRotation ( btVector3 v0,
btVector3 v1 
) const
protected

Definition at line 987 of file btKinematicCharacterController.cpp.

◆ getStepHeight()

btScalar btKinematicCharacterController::getStepHeight ( ) const
inline

Definition at line 167 of file btKinematicCharacterController.h.

◆ getUp()

const btVector3 & btKinematicCharacterController::getUp ( )
inline

Definition at line 132 of file btKinematicCharacterController.h.

◆ getUpAxisDirections()

btVector3 * btKinematicCharacterController::getUpAxisDirections ( )
staticprotected

Definition at line 937 of file btKinematicCharacterController.cpp.

◆ jump()

void btKinematicCharacterController::jump ( const btVector3 v = btVector3(0, 0, 0))
virtual

◆ needsCollision()

bool btKinematicCharacterController::needsCollision ( const btCollisionObject body0,
const btCollisionObject body1 
)
protectedvirtual

Definition at line 340 of file btKinematicCharacterController.cpp.

◆ onGround()

bool btKinematicCharacterController::onGround ( ) const
virtual

◆ parallelComponent()

btVector3 btKinematicCharacterController::parallelComponent ( const btVector3 direction,
const btVector3 normal 
)
protected

Definition at line 120 of file btKinematicCharacterController.cpp.

◆ perpindicularComponent()

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

Definition at line 129 of file btKinematicCharacterController.cpp.

◆ playerStep()

void btKinematicCharacterController::playerStep ( btCollisionWorld collisionWorld,
btScalar  dt 
)
virtual

◆ preStep()

void btKinematicCharacterController::preStep ( btCollisionWorld collisionWorld)
virtual

◆ recoverFromPenetration()

bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld collisionWorld)
protected

Definition at line 177 of file btKinematicCharacterController.cpp.

◆ reset()

void btKinematicCharacterController::reset ( btCollisionWorld collisionWorld)
virtual

◆ setAngularDamping()

void btKinematicCharacterController::setAngularDamping ( btScalar  d)
inline

Definition at line 157 of file btKinematicCharacterController.h.

◆ setAngularVelocity()

void btKinematicCharacterController::setAngularVelocity ( const btVector3 velocity)
virtual

Definition at line 633 of file btKinematicCharacterController.cpp.

◆ setFallSpeed()

void btKinematicCharacterController::setFallSpeed ( btScalar  fallSpeed)

Definition at line 852 of file btKinematicCharacterController.cpp.

◆ setGravity()

void btKinematicCharacterController::setGravity ( const btVector3 gravity)

Definition at line 894 of file btKinematicCharacterController.cpp.

◆ setJumpSpeed()

void btKinematicCharacterController::setJumpSpeed ( btScalar  jumpSpeed)

Definition at line 857 of file btKinematicCharacterController.cpp.

◆ setLinearDamping()

void btKinematicCharacterController::setLinearDamping ( btScalar  d)
inline

Definition at line 155 of file btKinematicCharacterController.h.

◆ setLinearVelocity()

void btKinematicCharacterController::setLinearVelocity ( const btVector3 velocity)
virtual

Definition at line 643 of file btKinematicCharacterController.cpp.

◆ setMaxJumpHeight()

void btKinematicCharacterController::setMaxJumpHeight ( btScalar  maxJumpHeight)

Definition at line 863 of file btKinematicCharacterController.cpp.

◆ setMaxPenetrationDepth()

void btKinematicCharacterController::setMaxPenetrationDepth ( btScalar  d)

Definition at line 917 of file btKinematicCharacterController.cpp.

◆ setMaxSlope()

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 906 of file btKinematicCharacterController.cpp.

◆ setStepHeight()

void btKinematicCharacterController::setStepHeight ( btScalar  h)

Definition at line 932 of file btKinematicCharacterController.cpp.

◆ setUp()

void btKinematicCharacterController::setUp ( const btVector3 up)

Definition at line 953 of file btKinematicCharacterController.cpp.

◆ setUpInterpolate()

void btKinematicCharacterController::setUpInterpolate ( bool  value)
virtual

◆ setUpVector()

void btKinematicCharacterController::setUpVector ( const btVector3 up)
protected

Definition at line 964 of file btKinematicCharacterController.cpp.

◆ setUseGhostSweepTest()

void btKinematicCharacterController::setUseGhostSweepTest ( bool  useGhostObjectSweepTest)
inline

Definition at line 191 of file btKinematicCharacterController.h.

◆ setVelocityForTimeInterval()

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

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 618 of file btKinematicCharacterController.cpp.

◆ setWalkDirection()

void btKinematicCharacterController::setWalkDirection ( const btVector3 walkDirection)
virtual

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 610 of file btKinematicCharacterController.cpp.

◆ stepDown()

void btKinematicCharacterController::stepDown ( btCollisionWorld collisionWorld,
btScalar  dt 
)
protected

Definition at line 466 of file btKinematicCharacterController.cpp.

◆ stepForwardAndStrafe()

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

Definition at line 384 of file btKinematicCharacterController.cpp.

◆ stepUp()

void btKinematicCharacterController::stepUp ( btCollisionWorld collisionWorld)
protected

Definition at line 257 of file btKinematicCharacterController.cpp.

◆ updateAction()

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

btActionInterface interface

Implements btActionInterface.

Definition at line 121 of file btKinematicCharacterController.h.

◆ updateTargetPositionBasedOnCollision()

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

Definition at line 347 of file btKinematicCharacterController.cpp.

◆ warp()

void btKinematicCharacterController::warp ( const btVector3 origin)
virtual

Member Data Documentation

◆ bounce_fix

bool btKinematicCharacterController::bounce_fix
protected

Definition at line 96 of file btKinematicCharacterController.h.

◆ full_drop

bool btKinematicCharacterController::full_drop
protected

Definition at line 95 of file btKinematicCharacterController.h.

◆ m_addedMargin

btScalar btKinematicCharacterController::m_addedMargin
protected

Definition at line 59 of file btKinematicCharacterController.h.

◆ m_angularDamping

btScalar btKinematicCharacterController::m_angularDamping
protected

Definition at line 83 of file btKinematicCharacterController.h.

◆ m_AngVel

btVector3 btKinematicCharacterController::m_AngVel
protected

Definition at line 64 of file btKinematicCharacterController.h.

◆ m_convexShape

btConvexShape* btKinematicCharacterController::m_convexShape
protected

Definition at line 42 of file btKinematicCharacterController.h.

◆ m_currentOrientation

btQuaternion btKinematicCharacterController::m_currentOrientation
protected

Definition at line 73 of file btKinematicCharacterController.h.

◆ m_currentPosition

btVector3 btKinematicCharacterController::m_currentPosition
protected

Definition at line 69 of file btKinematicCharacterController.h.

◆ m_currentStepOffset

btScalar btKinematicCharacterController::m_currentStepOffset
protected

Definition at line 70 of file btKinematicCharacterController.h.

◆ m_fallSpeed

btScalar btKinematicCharacterController::m_fallSpeed
protected

Definition at line 47 of file btKinematicCharacterController.h.

◆ m_ghostObject

btPairCachingGhostObject* btKinematicCharacterController::m_ghostObject
protected

Definition at line 41 of file btKinematicCharacterController.h.

◆ m_gravity

btScalar btKinematicCharacterController::m_gravity
protected

Definition at line 53 of file btKinematicCharacterController.h.

◆ m_halfHeight

btScalar btKinematicCharacterController::m_halfHeight
protected

Definition at line 39 of file btKinematicCharacterController.h.

◆ m_interpolateUp

bool btKinematicCharacterController::m_interpolateUp
protected

Definition at line 94 of file btKinematicCharacterController.h.

◆ m_jumpAxis

btVector3 btKinematicCharacterController::m_jumpAxis
protected

Definition at line 91 of file btKinematicCharacterController.h.

◆ m_jumpPosition

btVector3 btKinematicCharacterController::m_jumpPosition
protected

Definition at line 66 of file btKinematicCharacterController.h.

◆ m_jumpSpeed

btScalar btKinematicCharacterController::m_jumpSpeed
protected

Definition at line 48 of file btKinematicCharacterController.h.

◆ m_linearDamping

btScalar btKinematicCharacterController::m_linearDamping
protected

Definition at line 82 of file btKinematicCharacterController.h.

◆ m_manifoldArray

btManifoldArray btKinematicCharacterController::m_manifoldArray
protected

keep track of the contact manifolds

Definition at line 77 of file btKinematicCharacterController.h.

◆ m_maxJumpHeight

btScalar btKinematicCharacterController::m_maxJumpHeight
protected

Definition at line 50 of file btKinematicCharacterController.h.

◆ m_maxPenetrationDepth

btScalar btKinematicCharacterController::m_maxPenetrationDepth
protected

Definition at line 44 of file btKinematicCharacterController.h.

◆ m_maxSlopeCosine

btScalar btKinematicCharacterController::m_maxSlopeCosine
protected

Definition at line 52 of file btKinematicCharacterController.h.

◆ m_maxSlopeRadians

btScalar btKinematicCharacterController::m_maxSlopeRadians
protected

Definition at line 51 of file btKinematicCharacterController.h.

◆ m_normalizedDirection

btVector3 btKinematicCharacterController::m_normalizedDirection
protected

Definition at line 63 of file btKinematicCharacterController.h.

◆ m_SetjumpSpeed

btScalar btKinematicCharacterController::m_SetjumpSpeed
protected

Definition at line 49 of file btKinematicCharacterController.h.

◆ m_stepHeight

btScalar btKinematicCharacterController::m_stepHeight
protected

Definition at line 57 of file btKinematicCharacterController.h.

◆ m_targetOrientation

btQuaternion btKinematicCharacterController::m_targetOrientation
protected

Definition at line 74 of file btKinematicCharacterController.h.

◆ m_targetPosition

btVector3 btKinematicCharacterController::m_targetPosition
protected

Definition at line 71 of file btKinematicCharacterController.h.

◆ m_touchingContact

bool btKinematicCharacterController::m_touchingContact
protected

Definition at line 79 of file btKinematicCharacterController.h.

◆ m_touchingNormal

btVector3 btKinematicCharacterController::m_touchingNormal
protected

Definition at line 80 of file btKinematicCharacterController.h.

◆ m_turnAngle

btScalar btKinematicCharacterController::m_turnAngle
protected

Definition at line 55 of file btKinematicCharacterController.h.

◆ m_up

btVector3 btKinematicCharacterController::m_up
protected

Definition at line 90 of file btKinematicCharacterController.h.

◆ m_useGhostObjectSweepTest

bool btKinematicCharacterController::m_useGhostObjectSweepTest
protected

Definition at line 87 of file btKinematicCharacterController.h.

◆ m_useWalkDirection

bool btKinematicCharacterController::m_useWalkDirection
protected

Definition at line 88 of file btKinematicCharacterController.h.

◆ m_velocityTimeInterval

btScalar btKinematicCharacterController::m_velocityTimeInterval
protected

Definition at line 89 of file btKinematicCharacterController.h.

◆ m_verticalOffset

btScalar btKinematicCharacterController::m_verticalOffset
protected

Definition at line 46 of file btKinematicCharacterController.h.

◆ m_verticalVelocity

btScalar btKinematicCharacterController::m_verticalVelocity
protected

Definition at line 45 of file btKinematicCharacterController.h.

◆ m_walkDirection

btVector3 btKinematicCharacterController::m_walkDirection
protected

this is the desired walk direction, set by the user

Definition at line 62 of file btKinematicCharacterController.h.

◆ m_wasJumping

bool btKinematicCharacterController::m_wasJumping
protected

Definition at line 86 of file btKinematicCharacterController.h.

◆ m_wasOnGround

bool btKinematicCharacterController::m_wasOnGround
protected

Definition at line 85 of file btKinematicCharacterController.h.


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