25 #ifndef __I6ENGINE_MODULES_PHYSICSMANAGER_H__
26 #define __I6ENGINE_MODULES_PHYSICSMANAGER_H__
34 #include "LinearMath/btAlignedObjectArray.h"
36 class btBroadphaseInterface;
37 class btCollisionDispatcher;
38 class btCollisionShape;
39 class btCompoundShape;
40 class btDefaultCollisionConfiguration;
41 class btDiscreteDynamicsWorld;
42 class btDynamicsWorld;
45 class btSequentialImpulseConstraintSolver;
46 class btTypedConstraint;
47 struct btOverlapFilterCallback;
53 class PhysicsController;
60 static std::map<std::pair<PhysicsNode *, PhysicsNode *>, uint64_t>
_collisionPairs;
139 void remove(btRigidBody * body);
191 btAlignedObjectArray<btCollisionShape *> _collisionShapes;
193 btDiscreteDynamicsWorld * _dynamicsWorld;
194 btBroadphaseInterface * _broadphase;
195 btCollisionDispatcher * _dispatcher;
196 btDefaultCollisionConfiguration * _collisionConfiguration;
197 btSequentialImpulseConstraintSolver * _solver;
199 std::map<int64_t, PhysicsNode *> _nodes;
204 std::vector<PhysicsNode *> _tickList;
206 std::map<int64_t, std::vector<std::pair<int64_t, btTypedConstraint *>>> _constraints;
215 btOverlapFilterCallback * _filterCallback;
void setGravity(const Vec3 &gravity)
Sets the gravity of the world.
btCollisionShape * createFromFile(const api::attributeMap ¶ms)
Creates a new RigidBody from a collisionShape from a file.
void NewsUpdate(const api::GameMessage::Ptr &msg)
handles update messages for the PhysicsManager
btCollisionShape * createPlane(const api::attributeMap ¶ms)
Creates a new RigidBody with a planes collisionShape.
void Tick()
Ticks physics stuff.
void removeRigidBody(btRigidBody *rigidBody)
Removes the body from the world to stop simulation.
boost::shared_ptr< Message > Ptr
std::map< std::string, std::string > attributeMap
Implements 3-dimensional vectors.
Controls the physics world.
PhysicsManager(PhysicsController *pc)
constructor
btDynamicsWorld * getPhysicsWorld() const
static uint64_t _tickCount
counts ticks for this subsystem
void NewsCreate(const api::GameMessage::Ptr &msg)
handles create messages for the PhysicsManager
#define ASSERT_THREAD_SAFETY_HEADER
btCollisionShape * createEmptyShape()
creates an empty default shape
~PhysicsManager()
destructor
PhysicsNode * getPhysicsNode(const int64_t id)
returns the PhysicsNode with the given ID
btCollisionShape * createSphere(const api::attributeMap ¶ms)
Creates a new RigidBody with a sphere collisionShape.
void addTicker(PhysicsNode *pn)
adds a ticking PhysicsNode
void NewsDelete(const api::GameMessage::Ptr &msg)
handles delete messages for the PhysicsManager
Represents the physical state of an object simulated by the Bullet library. Contains the btTransform ...
btCompoundShape * createCompound()
Creates a new CompoundShape.
void removeTicker(PhysicsNode *pn)
removes a ticking PhysicsNode
btCollisionShape * createBox(const api::attributeMap ¶ms)
Creates a new RigidBody with a box collisionShape.
void removeShape(btCollisionShape *shape)
void addRigidBody(btRigidBody *rigidBody)
Adds the body to the world for simulation.
static std::map< std::pair< PhysicsNode *, PhysicsNode * >, uint64_t > _collisionPairs
stores all collision pairs