Sirikata
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
Sirikata::BulletCharacterController Class Reference

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

#include <BulletCharacterController.hpp>

Inheritance diagram for Sirikata::BulletCharacterController:
Collaboration diagram for Sirikata::BulletCharacterController:

List of all members.

Public Member Functions

 BulletCharacterController (btPairCachingGhostObject *ghostObject, btConvexShape *convexShape, btScalar stepHeight, int upAxis=1)
 ~BulletCharacterController ()
virtual void updateAction (btCollisionWorld *collisionWorld, btScalar deltaTime)
 btActionInterface interface
void debugDraw (btIDebugDraw *debugDrawer)
 btActionInterface interface
void setUpAxis (int axis)
virtual void setWalkDirection (const btVector3 &walkDirection)
 This should probably be called setPositionIncrementPerSimulatorStep.
virtual void setVelocityForTimeInterval (const btVector3 &velocity, btScalar timeInterval)
 Caller provides a velocity with which the character should move for the given time period.
void reset ()
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.
btScalar getMaxSlope () const
btPairCachingGhostObject * getGhostObject ()
void setUseGhostSweepTest (bool useGhostObjectSweepTest)
bool onGround () const

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 btVector3 * getUpAxisDirections ()

Protected Attributes

btScalar m_halfHeight
btPairCachingGhostObject * m_ghostObject
btConvexShape * m_convexShape
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
btVector3 m_normalizedDirection
btVector3 m_currentPosition
btScalar m_currentStepOffset
btVector3 m_targetPosition
btManifoldArray m_manifoldArray
 keep track of the contact manifolds
bool m_touchingContact
btVector3 m_touchingNormal
bool m_wasOnGround
bool m_wasJumping
bool m_useGhostObjectSweepTest
bool m_useWalkDirection
btScalar m_velocityTimeInterval
int m_upAxis

Detailed Description

BulletCharacterController 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 BulletCharacterController and dynamic rigid bodies needs to be explicity implemented by the user.


Constructor & Destructor Documentation

Sirikata::BulletCharacterController::BulletCharacterController ( btPairCachingGhostObject *  ghostObject,
btConvexShape *  convexShape,
btScalar  stepHeight,
int  upAxis = 1 
)
Sirikata::BulletCharacterController::~BulletCharacterController ( )

Member Function Documentation

bool Sirikata::BulletCharacterController::canJump ( ) const

References onGround().

Referenced by jump().

btVector3 Sirikata::BulletCharacterController::computeReflectionDirection ( const btVector3 &  direction,
const btVector3 &  normal 
) [protected]
void Sirikata::BulletCharacterController::debugDraw ( btIDebugDraw *  debugDrawer)

btActionInterface interface

btPairCachingGhostObject * Sirikata::BulletCharacterController::getGhostObject ( )

References m_ghostObject.

Referenced by stepDown(), stepForwardAndStrafe(), and stepUp().

btScalar Sirikata::BulletCharacterController::getGravity ( ) const

References m_gravity.

btScalar Sirikata::BulletCharacterController::getMaxSlope ( ) const

References m_maxSlopeRadians.

btVector3 * Sirikata::BulletCharacterController::getUpAxisDirections ( ) [static, protected]

Referenced by stepDown(), and stepUp().

void Sirikata::BulletCharacterController::jump ( )
bool Sirikata::BulletCharacterController::onGround ( ) const

References m_verticalOffset, and m_verticalVelocity.

Referenced by canJump(), and playerStep().

btVector3 Sirikata::BulletCharacterController::parallelComponent ( const btVector3 &  direction,
const btVector3 &  normal 
) [protected]
btVector3 Sirikata::BulletCharacterController::perpindicularComponent ( const btVector3 &  direction,
const btVector3 &  normal 
) [protected]
void Sirikata::BulletCharacterController::playerStep ( btCollisionWorld *  collisionWorld,
btScalar  dt 
)
void Sirikata::BulletCharacterController::preStep ( btCollisionWorld *  collisionWorld)
bool Sirikata::BulletCharacterController::recoverFromPenetration ( btCollisionWorld *  collisionWorld) [protected]
void Sirikata::BulletCharacterController::reset ( )
void Sirikata::BulletCharacterController::setFallSpeed ( btScalar  fallSpeed)

References m_fallSpeed.

void Sirikata::BulletCharacterController::setGravity ( btScalar  gravity)

References m_gravity.

void Sirikata::BulletCharacterController::setJumpSpeed ( btScalar  jumpSpeed)

References m_jumpSpeed.

void Sirikata::BulletCharacterController::setMaxJumpHeight ( btScalar  maxJumpHeight)

References m_maxJumpHeight.

void Sirikata::BulletCharacterController::setMaxSlope ( btScalar  slopeRadians)

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

The slope angle is measured in radians.

References m_maxSlopeCosine, and m_maxSlopeRadians.

Referenced by BulletCharacterController().

void Sirikata::BulletCharacterController::setUpAxis ( int  axis) [inline]

References m_upAxis.

void Sirikata::BulletCharacterController::setUseGhostSweepTest ( bool  useGhostObjectSweepTest) [inline]
void Sirikata::BulletCharacterController::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.

void Sirikata::BulletCharacterController::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().

Referenced by Sirikata::BulletCharacterObject::preTick().

void Sirikata::BulletCharacterController::stepDown ( btCollisionWorld *  collisionWorld,
btScalar  dt 
) [protected]
void Sirikata::BulletCharacterController::stepForwardAndStrafe ( btCollisionWorld *  collisionWorld,
const btVector3 &  walkMove 
) [protected]
void Sirikata::BulletCharacterController::stepUp ( btCollisionWorld *  collisionWorld) [protected]
virtual void Sirikata::BulletCharacterController::updateAction ( btCollisionWorld *  collisionWorld,
btScalar  deltaTime 
) [inline, virtual]

btActionInterface interface

References playerStep(), and preStep().

void Sirikata::BulletCharacterController::updateTargetPositionBasedOnCollision ( const btVector3 &  hit_normal,
btScalar  tangentMag = btScalar(0.0),
btScalar  normalMag = btScalar(1.0) 
) [protected]
void Sirikata::BulletCharacterController::warp ( const btVector3 &  origin)

References m_ghostObject.


Member Data Documentation

Referenced by stepDown(), and stepUp().

btPairCachingGhostObject* Sirikata::BulletCharacterController::m_ghostObject [protected]

keep track of the contact manifolds

Referenced by recoverFromPenetration().

Referenced by setMaxJumpHeight().

Referenced by setMaxSlope(), and stepDown().

Referenced by getMaxSlope(), and setMaxSlope().

Referenced by stepForwardAndStrafe().

Referenced by preStep(), and stepForwardAndStrafe().

this is the desired walk direction, set by the user

Referenced by BulletCharacterController(), and playerStep().


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