Character.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef ANKI_PHYSICS_CHARACTER_H
  2. #define ANKI_PHYSICS_CHARACTER_H
  3. #include "anki/Math.h"
  4. #include <memory>
  5. class btPairCachingGhostObject;
  6. class btConvexShape;
  7. class btKinematicCharacterController;
  8. class btGhostPairCallback;
  9. namespace anki {
  10. class MoveComponent;
  11. class PhysWorld;
  12. class MotionState;
  13. /// Its basically a wrapper around bullet character
  14. class Character
  15. {
  16. friend class PhysWorld;
  17. public:
  18. /// Initializer class
  19. struct Initializer
  20. {
  21. F32 characterHeight;
  22. F32 characterWidth;
  23. F32 stepHeight;
  24. F32 jumpSpeed;
  25. F32 maxJumpHeight;
  26. MoveComponent* movable; ///< For the MotionState
  27. Transform startTrf;
  28. Initializer();
  29. };
  30. Character(PhysWorld* masterContainer, const Initializer& init);
  31. ~Character();
  32. void rotate(F32 angle);
  33. void moveForward(F32 distance);
  34. void jump();
  35. private:
  36. PhysWorld* masterContainer; ///< Know your father
  37. btPairCachingGhostObject* ghostObject;
  38. btConvexShape* convexShape;
  39. btKinematicCharacterController* character;
  40. btGhostPairCallback* ghostPairCallback;
  41. std::unique_ptr<MotionState> motionState;
  42. };
  43. } // end namespace
  44. #endif