void BallisticDemo::updateObjects(cyclone::real duration) { if (duration <= 0.0f) return; for (int i = 0; i < NUM_LAUNCHERS; i++) { launchers[i]->body->integrate(duration); launchers[i]->calculateInternals(); } // Update the physics of each particle in turn for (AmmoRound *shot = ammo; shot < ammo+ammoRounds; shot++) { if (shot->type != UNUSED) { // Run the physics shot->body->integrate(duration); shot->calculateInternals(); // Check if the particle is now invalid if (shot->body->getPosition().x < 0.0f || shot->startTime+5000 < TimingData::get().lastFrameTimestamp || shot->body->getPosition().z > 200.0f) { // We simply set the shot type to be unused, so the // memory it occupies can be reused by another shot. shot->type = UNUSED; } } } }
void BigBallisticDemo::updateObjects(cyclone::real duration) { // Update the physics of each particle in turn for (AmmoRound *shot = ammo; shot < ammo+ammoRounds; shot++) { if (shot->type != UNUSED) { // Run the physics shot->body->integrate(duration); shot->calculateInternals(); // Check if the particle is now invalid if (shot->body->getPosition().y < 0.0f || shot->startTime+5000 < TimingData::get().lastFrameTimestamp || shot->body->getPosition().z > 200.0f) { // We simply set the shot type to be unused, so the // memory it occupies can be reused by another shot. shot->type = UNUSED; } } } // Update the boxes for (Box *box = boxData; box < boxData+boxes; box++) { // Run the physics box->body->integrate(duration); box->calculateInternals(); } }