示例#1
0
//--------------------------------------------------------------
void ofApp::update(){
    t += dt;
    
    
    
    
    for(int i=0;i<numBoids;i++){
        Boid * b = boids.at(i);
        b->update(maxAccel);
    }
    
    
}
示例#2
0
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();
	}
}