public void Update() {
if (Nearby > 0) {
Cohesion = Cohesion / Nearby;
Cohesion = Attraction * (Cohesion - position) / 100.0;
Alignment = Alignment / Nearby;
Alignment = (Alignment - velocity) / 8.0;
}
velocity = velocity + Cohesion;
velocity = velocity + Separation;
velocity = velocity + Alignment;
velocity = velocity + BoundPosition();
velocity = velocity + Tendency();
LimitVelocity();
position = position + velocity;
Nearby = 0;
Cohesion = new Vector3D(0.0, 0.0, 0.0);
Separation = new Vector3D(0.0, 0.0, 0.0);
Alignment = new Vector3D(0.0, 0.0, 0.0);
}