Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Demos / CharacterDemo / DynamicCharacterController.h
1 #ifndef CHARACTER_CONTROLLER_H
2 #define CHARACTER_CONTROLLER_H
3
4 #include "LinearMath/btVector3.h"
5
6 #include "BulletDynamics/Character/btCharacterControllerInterface.h"
7
8 class btCollisionShape;
9 class btRigidBody;
10 class btCollisionWorld;
11
12 ///DynamicCharacterController is obsolete/unsupported at the moment
13 class DynamicCharacterController : public btCharacterControllerInterface
14 {
15 protected:
16         btScalar m_halfHeight;
17         btCollisionShape* m_shape;
18         btRigidBody* m_rigidBody;
19
20         btVector3 m_raySource[2];
21         btVector3 m_rayTarget[2];
22         btScalar m_rayLambda[2];
23         btVector3 m_rayNormal[2];
24
25         btScalar m_turnAngle;
26
27         btScalar m_maxLinearVelocity;
28         btScalar m_walkVelocity;
29         btScalar m_turnVelocity;
30 public:
31         DynamicCharacterController ();
32         ~DynamicCharacterController ();
33         void setup (btScalar height = 2.0, btScalar width = 0.25, btScalar stepHeight = 0.25);
34         void destroy ();
35
36         virtual void reset ();
37         virtual void warp (const btVector3& origin);
38         virtual void registerPairCacheAndDispatcher (btOverlappingPairCache* pairCache, btCollisionDispatcher* dispatcher);
39
40         btCollisionObject* getCollisionObject ();
41
42         void preStep (const btCollisionWorld* collisionWorld);
43         void playerStep (const btCollisionWorld* collisionWorld,btScalar dt,
44                                          int forward,
45                                          int backward,
46                                          int left,
47                                          int right,
48                                          int jump);
49         bool canJump () const;
50         void jump ();
51
52         bool onGround () const;
53 };
54
55 #endif