1 #ifndef RADIX_COMPONENT_PLAYER_HPP
2 #define RADIX_COMPONENT_PLAYER_HPP
7 #include <bullet/btBulletDynamicsCommon.h>
8 #include <bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h>
9 #include <bullet/BulletCollision/CollisionDispatch/btGhostObject.h>
10 #include <bullet/BulletDynamics/Character/btKinematicCharacterController.h>
25 std::map<int, PlayerTask*>
tasks;
26 std::shared_ptr<btConvexShape>
shape;
27 btPairCachingGhostObject *
obj;
44 return Component::getTypeId<std::remove_reference<decltype(*this)>::type>();
51 static_assert(std::is_base_of<PlayerTask, T>::value,
"T must be a PlayerTask");
54 int id = tasks.rbegin()->first + 1;
56 tasks.insert(std::make_pair(
id, result));
59 tasks.insert(std::make_pair(0, result));
75 virtual btScalar
addSingleResult(btManifoldPoint& cp,
const btCollisionObjectWrapper* colObj0Wrap,
76 int partId0,
int index0,
const btCollisionObjectWrapper* colObj1Wrap,
int partId1,
int index1) {
77 Entity* playerEntity = (
Entity*) colObj0Wrap->getCollisionObject()->getUserPointer();
78 Entity* triggerEntity = (
Entity*) colObj1Wrap->getCollisionObject()->getUserPointer();
Trigger * trigger
Definition: Player.hpp:29
float stepCounter
Definition: Player.hpp:34
KinematicCharacterController * controller
Definition: Player.hpp:28
~Player()
Definition: Player.cpp:30
T & addTask()
Definition: Player.hpp:50
Definition: GameController.hpp:7
bool hasComponent() const
Definition: Entity.hpp:134
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
void onUpdate(BaseGame *game)
Definition: Trigger.hpp:54
T & getComponent() const
Definition: Entity.hpp:140
Definition: Vector4f.hpp:117
TypeId getTypeId() const
Definition: Player.hpp:43
Quaternion getHeadOrientation() const
Definition: Player.cpp:52
Quaternion getBaseHeadOrientation() const
Definition: Player.cpp:48
bool noclip
Definition: Player.hpp:32
void serialize(serine::Archiver &)
Definition: Player.cpp:39
bool flying
Definition: Player.hpp:32
Base class to create entity components.
Definition: Component.hpp:25
btPairCachingGhostObject * obj
Definition: Player.hpp:27
Vector3f headAngle
Definition: Player.hpp:31
std::map< int, PlayerTask * > tasks
Definition: Player.hpp:25
Definition: Player.hpp:23
void removeTask(int id)
Definition: Player.cpp:43
ComponentTypeId TypeId
Definition: Component.hpp:35
std::shared_ptr< btConvexShape > shape
Definition: Player.hpp:26
Player(Entity &)
Definition: Player.cpp:7
float speed
Definition: Player.hpp:33
const char * getName() const
Definition: Player.hpp:39
bool frozen
Definition: Player.hpp:32
Definition: BaseGame.hpp:22
KinematicCharacterController is an object that supports a sliding motion in a world.
Definition: KinematicCharacterController.hpp:46
Vector3f velocity
Definition: Player.hpp:31
3-dimensional float-based vector/point storage and manipulation struct
Definition: Vector3f.hpp:27
Definition: Trigger.hpp:16