Game Development Reference
In-Depth Information
*/
class ParticleContactGenerator
{
public:
/**
* Fills the given contact structure with the generated
* contact. The contact pointer should point to the first
* available contact in a contact array, where limit is the
* maximum number of contacts in the array that can be written
* to. The method returns the number of contacts that have
* been written.
*/
virtual unsigned addContact(ParticleContact *contact,
unsigned limit) const = 0;
};
Each of these gets called in turn from the world and can contribute any contacts
it finds back to the world by calling its addContact method.
To execute the physics, the runPhysics method is called. This calls all the force
generators to apply their forces and then performs the integration of all objects, runs
the contact detectors, and resolves the resulting contact list:
Excerpt from include/cyclone/pworld.h
/**
* Keeps track of a set of particles, and provides the means to
* update them all.
*/
class ParticleWorld
{
/// ... previous ParticleWorld code as before ...
/**
* Holds the force generators for the particles in this world.
*/
ParticleForceRegistry registry;
/**
* Holds the resolver for contacts.
*/
ParticleContactResolver resolver;
/**
* Holds one registered contact generator.
*/
Search Nedrilad ::




Custom Search