#include <PhysicsWorld.hpp>
Public Member Functions | |
PhysicsWorld (SceneManager *pManager) | |
Constructor. | |
~PhysicsWorld () | |
Destructor. | |
bool | addWorldEntity (const std::string &name, const Ogre::MeshPtr &pWorldMesh) |
Add the main world entity to the physics world. | |
bool | addCameraEntity (const std::string &name, const float mass, const Ogre::Vector3 &initialPosition, const Ogre::Quaternion &initialOrientation, const float sphereRadius) |
Add a camera entity to the physics world. | |
bool | addBoxEntity (const std::string &name, const float mass, const Ogre::Vector3 &initialPosition, const Ogre::Quaternion &initialOrientation, const Ogre::Vector3 &bounds) |
Add an entity to the physics world, representing it as a box. | |
bool | removeEntity (const std::string &name) |
Remove an entity from the physics world. | |
void | update (const float timeSinceLastUpdate) |
Update the physics world. | |
void | updateCameraEntity (const std::string &name, const Ogre::Vector3 &initialPosition, const Ogre::Quaternion &initialOrientation) |
Update camera entity. | |
bool | getEntityTransform (const std::string &name, Ogre::Vector3 &position, Ogre::Quaternion &orientation) |
Get the position and the orientation of an entity. | |
Private Attributes | |
SceneManager * | m_pManager |
Manager. | |
std::map < std::string, EntityDescriptor > | m_mapEntities |
List of physics entities. | |
std::map < btRigidBody *, EntityDescriptor > | m_mapEntities2 |
List of physics entities with another key for the map. | |
btCollisionConfiguration * | m_pConfiguration |
Collision configuration. | |
btCollisionDispatcher * | m_pDispatcher |
Collision dispatcher. | |
btBroadphaseInterface * | m_pBroadphase |
Broadphase (?). | |
btSequentialImpulseConstraintSolver * | m_pSolver |
Constraint solver. | |
btDiscreteDynamicsWorld * | m_pDynamicsWorld |
Dynamics world. | |
Classes | |
struct | EntityDescriptor |
Entity descriptor. More... |
It allows to initialize a physics world and to run simulations on it.
syBR::Game::PhysicsWorld::PhysicsWorld | ( | SceneManager * | pManager | ) |
syBR::Game::PhysicsWorld::~PhysicsWorld | ( | ) |
Destructor.
bool syBR::Game::PhysicsWorld::addWorldEntity | ( | const std::string & | name, | |
const Ogre::MeshPtr & | pWorldMesh | |||
) |
Add the main world entity to the physics world.
The world entity will be added to the physics world as a triangles mesh.
name | Name of the entity | |
pWorldMesh | World mesh |
bool syBR::Game::PhysicsWorld::addCameraEntity | ( | const std::string & | name, | |
const float | mass, | |||
const Ogre::Vector3 & | initialPosition, | |||
const Ogre::Quaternion & | initialOrientation, | |||
const float | sphereRadius | |||
) |
Add a camera entity to the physics world.
name | Name of the entity | |
mass | Mass of the entity | |
initialPosition | Initial position of the entity | |
initialOrientation | Initial orientation of the entity | |
sphereRadius | Radius of the sphere used for the shape of the camera |
bool syBR::Game::PhysicsWorld::addBoxEntity | ( | const std::string & | name, | |
const float | mass, | |||
const Ogre::Vector3 & | initialPosition, | |||
const Ogre::Quaternion & | initialOrientation, | |||
const Ogre::Vector3 & | bounds | |||
) |
Add an entity to the physics world, representing it as a box.
name | Name of the entity | |
mass | Mass of the entity | |
initialPosition | Initial position of the entity | |
initialOrientation | Initial orientation of the entity | |
bounds | Extents of the box |
bool syBR::Game::PhysicsWorld::removeEntity | ( | const std::string & | name | ) |
Remove an entity from the physics world.
name | Name of the entity to remove |
void syBR::Game::PhysicsWorld::update | ( | const float | timeSinceLastUpdate | ) |
Update the physics world.
timeSinceLastUpdate | Time since last update in seconds |
void syBR::Game::PhysicsWorld::updateCameraEntity | ( | const std::string & | name, | |
const Ogre::Vector3 & | position, | |||
const Ogre::Quaternion & | orientation | |||
) |
Update camera entity.
name | ||
position | ||
orientation |
bool syBR::Game::PhysicsWorld::getEntityTransform | ( | const std::string & | name, | |
Ogre::Vector3 & | position, | |||
Ogre::Quaternion & | orientation | |||
) |
Get the position and the orientation of an entity.
name | Name fo the entity whose position and transformation must be retrieved | |
position | Will be set to the current position of the entity in the physics world | |
orientation | Will be set to the current orientation of the entity in the physics world |
SceneManager* syBR::Game::PhysicsWorld::m_pManager [private] |
Manager.
std::map<std::string, EntityDescriptor> syBR::Game::PhysicsWorld::m_mapEntities [private] |
List of physics entities.
std::map<btRigidBody *, EntityDescriptor> syBR::Game::PhysicsWorld::m_mapEntities2 [private] |
List of physics entities with another key for the map.
btCollisionConfiguration* syBR::Game::PhysicsWorld::m_pConfiguration [private] |
Collision configuration.
btCollisionDispatcher* syBR::Game::PhysicsWorld::m_pDispatcher [private] |
Collision dispatcher.
btBroadphaseInterface* syBR::Game::PhysicsWorld::m_pBroadphase [private] |
Broadphase (?).
btSequentialImpulseConstraintSolver* syBR::Game::PhysicsWorld::m_pSolver [private] |
Constraint solver.
btDiscreteDynamicsWorld* syBR::Game::PhysicsWorld::m_pDynamicsWorld [private] |
Dynamics world.
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008