Game Development Reference
3. The collision system accumulates a set of contact objects and passes them to the
contact resolver. Any bit of code can generate new contacts. We have considered
two: a collision detector and rod or cable constraints.
At each frame we take each particle, calculate its internal data, call its force gen-
erators, and then call its integrator to update its position and velocity. We then accu-
mulate the contacts on the particle and pass all the contacts for all the particles into
the collision resolver.
To make this process easier we will construct a simple structure to hold any num-
ber of rigid bodies. We hold the rigid bodies in a linked list, exactly as we did for
force generators. This linked list is contained in a World class, representing the whole
physically simulated world:
Excerpt from include/cyclone/pworld.h
* Keeps track of a set of particles, and provides the means to
* update them all.
* Holds one particle in the linked list of particles.
* Holds the list of registrations.
* Creates a new particle simulator that can handle up to the
* given number of contacts per frame. You can also optionally
* give a number of contact-resolution iterations to use. If you
* don't give a number of iterations, then twice the number of
* contacts will be used.