syBR::Game::PhysicsWorld Class Reference

PhysicsWorld class declaration. More...

#include <PhysicsWorld.hpp>

List of all members.

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

SceneManagerm_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...


Detailed Description

PhysicsWorld class declaration.

It allows to initialize a physics world and to run simulations on it.


Constructor & Destructor Documentation

syBR::Game::PhysicsWorld::PhysicsWorld ( SceneManager pManager  ) 

Constructor.

Parameters:
pManager Scene manager responsible of this physics world
Todo:
use a better world AAB

syBR::Game::PhysicsWorld::~PhysicsWorld (  ) 

Destructor.


Member Function Documentation

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.

Parameters:
name Name of the entity
pWorldMesh World mesh
Returns:
One of these:
  • true in case of success
  • false otherwise

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.

Parameters:
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
Returns:
One of these:
  • true in case of success
  • false otherwise

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.

Parameters:
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
Returns:
One of these:
  • true in case of success
  • false otherwise

bool syBR::Game::PhysicsWorld::removeEntity ( const std::string &  name  ) 

Remove an entity from the physics world.

Parameters:
name Name of the entity to remove
Returns:
One of these
  • true in case of success
  • false otherwise

void syBR::Game::PhysicsWorld::update ( const float  timeSinceLastUpdate  ) 

Update the physics world.

Parameters:
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.

Parameters:
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.

Parameters:
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
Returns:
One of these:
  • true if the position and / or orientation has been updated
  • false otherwise


Member Data Documentation

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.


The documentation for this class was generated from the following files:

Copyright © 2008 by Sebastien Frippiat
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008