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
RigidBody.hpp
Go to the documentation of this file.
1 #ifndef RADIX_COMPONENT_RIGIDBODY_HPP
2 #define RADIX_COMPONENT_RIGIDBODY_HPP
3 
4 #include <memory>
5 
6 #include <bullet/BulletCollision/CollisionShapes/btCollisionShape.h>
7 #include <bullet/BulletDynamics/Dynamics/btRigidBody.h>
8 #include <bullet/LinearMath/btDefaultMotionState.h>
9 
12 #include <radix/Entity.hpp>
13 #include <radix/EntityManager.hpp>
14 
15 namespace radix {
16 
17 class RigidBody : public Component {
18 public:
19  std::shared_ptr<btCollisionShape> shape;
20  btDefaultMotionState motionState;
21  btRigidBody *body;
22 
23  RigidBody(Entity &ent);
24  RigidBody(Entity &ent, float mass, const std::shared_ptr<btCollisionShape> &collisionshape);
25  ~RigidBody();
26 
27  const char* getName() const {
28  return "RigidBody";
29  }
30 
31  TypeId getTypeId() const {
32  return Component::getTypeId<std::remove_reference<decltype(*this)>::type>();
33  }
34 
35  void serialize(serine::Archiver&);
36 };
37 
38 } /* namespace radix */
39 
40 #endif /* RADIX_COMPONENT_RIGIDBODY_HPP */
Definition: GameController.hpp:7
btDefaultMotionState motionState
Definition: RigidBody.hpp:20
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
RigidBody(Entity &ent)
Definition: RigidBody.cpp:5
const char * getName() const
Definition: RigidBody.hpp:27
Base class to create entity components.
Definition: Component.hpp:25
ComponentTypeId TypeId
Definition: Component.hpp:35
~RigidBody()
Definition: RigidBody.cpp:25
void serialize(serine::Archiver &)
Definition: RigidBody.cpp:29
TypeId getTypeId() const
Definition: RigidBody.hpp:31
btRigidBody * body
Definition: RigidBody.hpp:21
std::shared_ptr< btCollisionShape > shape
Definition: RigidBody.hpp:19
Definition: RigidBody.hpp:17