Game Development Reference
In-Depth Information
* and torques for this frame added.
*/
void startFrame();
};
Excerpt from src/world.cpp
void World::startFrame()
{
BodyRegistration *reg = firstBody;
while (reg)
{
// Remove all forces from the accumulator.
reg->body->clearAccumulators();
reg->body->calculateDerivedData();
// Get the next registration.
reg = reg->next;
}
}
Again, additional forces can be applied after calling this 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:
Excerpt from include/cyclone/world.h
/**
* The world represents an independent simulation of physics. It
* keeps track of a set of rigid bodies, and provides the means to
* update them all.
*/
class World
{
// ... other World data as before ...
/**
* Processes all the physics for the world.
*/
void runPhysics(real duration);
};
Excerpt from src/world.cpp
void World::runPhysics(real duration)
{
// First apply the force generators
//registry.updateForces(duration);
Search Nedrilad ::




Custom Search