//-------------------------------------------------------------- void ofApp::update(){ t += dt; for(int i=0;i<numBoids;i++){ Boid * b = boids.at(i); b->update(maxAccel); } }
void BoidFlock::update() { for (unsigned i = 0; i < boidCount; i++) { Boid *b = boids[i]; vec3 v1 = rule1(b); vec3 v2 = rule2(b); vec3 v3 = rule3(b); vec3 pos = boundPosition(b); b->incVelocity((v1 + v2 + v3 + pos) / 100.0f); limitSpeed(b); b->update(); } }