physics::World< d > Class Template Reference

#include <world.h>

List of all members.

Public Member Functions

 World (float timestep=Globals::DEFAULT_TIMESTEP, BroadPhase< d > *broadphase=0, ContactGenerator< d > *contactGenerator=0, ContactList< d > *contactList=0, ContactResolver< d > *velocityResolver=0, ContactResolver< d > *positionResolver=0)
 ~World ()
void add (Body *body)
void remove (Body *body)
body_iterator remove (body_iterator it)
void add (Shape *shape)
void add (Joint *joint)
void remove (Joint *joint)
void add (ForceGenerator *generator)
void remove (ForceGenerator *generator)
void step ()
std::list< Body * > findBeneathAll (const Vector &position)
std::list< Body * > findBeneathAll (const AARect &rect) const
BodyfindBeneath (const Vector &position) const
BodyfindBeneath (const AARect &rect)
BodyintersectRay (const Vector &start, const Vector &dir, Vector &p) const
BodyintersectRay (const Vector &start, const Vector &dir) const


Detailed Description

template<typename d>
class physics::World< d >

This class defines the World within the which the bodies are created and the physics simulation takes place.

Constructor & Destructor Documentation

template<typename d>
World::World ( float  timestep = Globals::DEFAULT_TIMESTEP,
BroadPhase< d > *  broadphase = 0,
ContactGenerator< d > *  contactGenerator = 0,
ContactList< d > *  contactList = 0,
ContactResolver< d > *  velocityResolver = 0,
ContactResolver< d > *  positionResolver = 0 
) [inline]

You can pass in 0 to any of these parameters to use the default algorithm, or provide a specific implementation you want to use.

template<typename d>
World::~World (  )  [inline]

Deletes everything in this world. If there is something you don't want to be deleted, you should remove it from the world first.


Member Function Documentation

template<typename d>
void World::add ( Body body  )  [inline]

Add a body to the world. Note: this cannot be safely called from within a loop iterating over the bodies container.

template<typename d>
void World::remove ( Body body  )  [inline]

Remove this body from the world. Note: this cannot be safely called from within a loop iterating over the bodies container. You should use remove(World::body_iterator) instead.

template<typename d>
World< d >::body_iterator World::remove ( body_iterator  it  )  [inline]

Remove a body from the world given an iterator to that body. Returns an iterator to the next body in the container.

template<typename d>
void World::add ( Shape *  shape  )  [inline]

Add a static body to the world with this shape.

template<typename d>
void World::add ( Joint joint  )  [inline]

Add a joint to the world.

template<typename d>
void World::remove ( Joint joint  )  [inline]

Remove a joint from the world.

template<typename d>
void World::add ( ForceGenerator generator  )  [inline]

Add a force generator to the world.

template<typename d>
void World::remove ( ForceGenerator generator  )  [inline]

Remove a force generator from the world.

template<typename d>
void World::step (  )  [inline]

Simulate one frame.

template<typename d>
std::list<Body*> physics::World< d >::findBeneathAll ( const Vector &  position  ) 

Find all bodies located at this position (if any).

template<typename d>
std::list< typename d::Body * > World::findBeneathAll ( const AARect &  rect  )  const [inline]

Find all bodies touching this rect.

template<typename d>
d::Body * World::findBeneath ( const Vector &  position  )  const [inline]

Find the first body located at this position (if any).

template<typename d>
Body* physics::World< d >::findBeneath ( const AARect &  rect  ) 

Find the first body touching this rect

template<typename d>
d::Body * World::intersectRay ( const Vector &  start,
const Vector &  dir,
Vector &  p 
) const [inline]

Intersect a ray with the world and return the first Body it hits

Parameters:
start Origin of the ray.
dir Direction of the ray.
p Set by reference to the intersection point found.

template<typename d>
d::Body * World::intersectRay ( const Vector &  start,
const Vector &  dir 
) const [inline]

Intersect a ray with the world and return the first Body it hits

Parameters:
start Origin of the ray.
dir Direction of the ray.


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

Generated on Thu Apr 23 22:51:40 2009 for Large Polygon Collider - Modular 2D/3D Physics Engine by  doxygen 1.5.6