GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
radix::KinematicCharacterController Class Reference

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

#include <external/RadixEngine/include/radix/physics/KinematicCharacterController.hpp>

Inherits btCharacterControllerInterface.

Public Member Functions

 BT_DECLARE_ALIGNED_ALLOCATOR ()
 
 KinematicCharacterController (btPairCachingGhostObject *ghostObject, btConvexShape *convexShape, btScalar stepHeight, int upAxis=1)
 
 ~KinematicCharacterController ()
 
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 (const btVector3 &dir=btVector3())
 
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
 
btPairCachingGhostObject * getGhostObject ()
 
void setUseGhostSweepTest (bool useGhostObjectSweepTest)
 
bool onGround () const
 
void setUpInterpolate (bool value)
 

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 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

KinematicCharacterController 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.

Constructor & Destructor Documentation

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

Member Function Documentation

radix::KinematicCharacterController::BT_DECLARE_ALIGNED_ALLOCATOR ( )
bool radix::KinematicCharacterController::canJump ( ) const
btVector3 radix::KinematicCharacterController::computeReflectionDirection ( const btVector3 &  direction,
const btVector3 &  normal 
)
protected
void radix::KinematicCharacterController::debugDraw ( btIDebugDraw *  debugDrawer)

btActionInterface interface

btPairCachingGhostObject * radix::KinematicCharacterController::getGhostObject ( )
btScalar radix::KinematicCharacterController::getGravity ( ) const
btScalar radix::KinematicCharacterController::getMaxSlope ( ) const
btVector3 * radix::KinematicCharacterController::getUpAxisDirections ( )
staticprotected
void radix::KinematicCharacterController::jump ( const btVector3 &  dir = btVector3())
bool radix::KinematicCharacterController::onGround ( ) const
btVector3 radix::KinematicCharacterController::parallelComponent ( const btVector3 &  direction,
const btVector3 &  normal 
)
protected
btVector3 radix::KinematicCharacterController::perpindicularComponent ( const btVector3 &  direction,
const btVector3 &  normal 
)
protected
void radix::KinematicCharacterController::playerStep ( btCollisionWorld *  collisionWorld,
btScalar  dt 
)
void radix::KinematicCharacterController::preStep ( btCollisionWorld *  collisionWorld)
bool radix::KinematicCharacterController::recoverFromPenetration ( btCollisionWorld *  collisionWorld)
protected
void radix::KinematicCharacterController::reset ( btCollisionWorld *  collisionWorld)
void radix::KinematicCharacterController::setFallSpeed ( btScalar  fallSpeed)
void radix::KinematicCharacterController::setGravity ( btScalar  gravity)
void radix::KinematicCharacterController::setJumpSpeed ( btScalar  jumpSpeed)
void radix::KinematicCharacterController::setMaxJumpHeight ( btScalar  maxJumpHeight)
void radix::KinematicCharacterController::setMaxSlope ( btScalar  slopeRadians)

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

The slope angle is measured in radians.

void radix::KinematicCharacterController::setUpAxis ( int  axis)
inline
void radix::KinematicCharacterController::setUpInterpolate ( bool  value)
void radix::KinematicCharacterController::setUseGhostSweepTest ( bool  useGhostObjectSweepTest)
inline
void radix::KinematicCharacterController::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 radix::KinematicCharacterController::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().

void radix::KinematicCharacterController::stepDown ( btCollisionWorld *  collisionWorld,
btScalar  dt 
)
protected
void radix::KinematicCharacterController::stepForwardAndStrafe ( btCollisionWorld *  collisionWorld,
const btVector3 &  walkMove 
)
protected
void radix::KinematicCharacterController::stepUp ( btCollisionWorld *  collisionWorld)
protected
virtual void radix::KinematicCharacterController::updateAction ( btCollisionWorld *  collisionWorld,
btScalar  deltaTime 
)
inlinevirtual

btActionInterface interface

void radix::KinematicCharacterController::updateTargetPositionBasedOnCollision ( const btVector3 &  hit_normal,
btScalar  tangentMag = btScalar(0.0),
btScalar  normalMag = btScalar(1.0) 
)
protected
void radix::KinematicCharacterController::warp ( const btVector3 &  origin)

Field Documentation

bool radix::KinematicCharacterController::bounce_fix
protected
bool radix::KinematicCharacterController::full_drop
protected
btScalar radix::KinematicCharacterController::m_addedMargin
protected
btConvexShape* radix::KinematicCharacterController::m_convexShape
protected
btVector3 radix::KinematicCharacterController::m_currentPosition
protected
btScalar radix::KinematicCharacterController::m_currentStepOffset
protected
btScalar radix::KinematicCharacterController::m_fallSpeed
protected
btPairCachingGhostObject* radix::KinematicCharacterController::m_ghostObject
protected
btScalar radix::KinematicCharacterController::m_gravity
protected
btScalar radix::KinematicCharacterController::m_halfHeight
protected
bool radix::KinematicCharacterController::m_interpolateUp
protected
btScalar radix::KinematicCharacterController::m_jumpSpeed
protected
btManifoldArray radix::KinematicCharacterController::m_manifoldArray
protected

keep track of the contact manifolds

btScalar radix::KinematicCharacterController::m_maxJumpHeight
protected
btScalar radix::KinematicCharacterController::m_maxSlopeCosine
protected
btScalar radix::KinematicCharacterController::m_maxSlopeRadians
protected
btVector3 radix::KinematicCharacterController::m_normalizedDirection
protected
btScalar radix::KinematicCharacterController::m_stepHeight
protected
btVector3 radix::KinematicCharacterController::m_targetPosition
protected
bool radix::KinematicCharacterController::m_touchingContact
protected
btVector3 radix::KinematicCharacterController::m_touchingNormal
protected
btScalar radix::KinematicCharacterController::m_turnAngle
protected
int radix::KinematicCharacterController::m_upAxis
protected
bool radix::KinematicCharacterController::m_useGhostObjectSweepTest
protected
bool radix::KinematicCharacterController::m_useWalkDirection
protected
btScalar radix::KinematicCharacterController::m_velocityTimeInterval
protected
btScalar radix::KinematicCharacterController::m_verticalOffset
protected
btScalar radix::KinematicCharacterController::m_verticalVelocity
protected
btVector3 radix::KinematicCharacterController::m_walkDirection
protected

this is the desired walk direction, set by the user

bool radix::KinematicCharacterController::m_wasJumping
protected
bool radix::KinematicCharacterController::m_wasOnGround
protected

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