Files
bullet3/Demos/CharacterDemo/CharacterController.h
2008-02-27 19:49:25 +00:00

48 lines
1006 B
C++

#ifndef CHARACTER_CONTROLLER_H
#define CHARACTER_CONTROLLER_H
#include "LinearMath/btVector3.h"
class btCollisionShape;
class btRigidBody;
class btDynamicsWorld;
class CharacterController
{
protected:
btScalar m_halfHeight;
btCollisionShape* m_shape;
btRigidBody* m_rigidBody;
btVector3 m_raySource[2];
btVector3 m_rayTarget[2];
btScalar m_rayLambda[2];
btVector3 m_rayNormal[2];
btScalar m_turnAngle;
btScalar m_maxLinearVelocity;
btScalar m_walkVelocity;
btScalar m_turnVelocity;
public:
CharacterController ();
~CharacterController ();
void setup (btDynamicsWorld* dynamicsWorld, btScalar height = 2.0, btScalar width = 0.25);
void destroy (btDynamicsWorld* dynamicsWorld);
btRigidBody* getRigidBody ();
void preStep (btDynamicsWorld* dynamicsWorld);
void playerStep (btScalar dt,
int forward,
int backward,
int left,
int right);
bool canJump () const;
void jump ();
bool onGround () const;
};
#endif