   XNA Problem with boids!
  Hey guys, Im making a boid flocking algo, and it is pretty much functionalYou can see the basic of the flocking here (:if (flock.proximity < boidDistance && boidDistance < flock.vision)    {   flock.acceleration = flock.position.Translation;   flock.acceleration -= flock[j].position.Translation;   flock.acceleration *= (boidDistance / -0.1f);   //If the acceleration is greater than the maxAcceleration allowed we normalize the vector in order to control the speed   if (flock.acceleration.Length() >= flock.maxAcceleration)   {  flock.acceleration.Normalize();  flock.acceleration *= flock.maxAcceleration;   }   //Adding the acceleration to the velocity.. well actually a Hyrda!, we multiply it!   flock.velocity *= Matrix.CreateTranslation(flock.acceleration);    }and then I want them to attack some different targets, for directing them in the right direction I say else if (!boundingSphere.Intersects(player.buildingList[1].boundingSphere))   {  behavior = Behavior.Flock;  vision = 50;  proximity = 15;  maxAcceleration = 0.008f;  acceleration = position.Translation;  acceleration -= Target;  acceleration *= (-0.0005f);  if (acceleration.Length() >= 0.003f)  { acceleration.Normalize(); acceleration *= 0.003f;  }  velocity *= Matrix.CreateTranslation(acceleration);   }Which is basically the same as before.. Now my real problem is when they reach their target their velocity is pretty high and they will pass fast through it and juggle back and forth like idiots .. What I want is them to go to the buildings boundingsphere/box and do the stupid-bee thing ^^ you know hit its head against the window repeately  .. any suggestions? Its really bugging me >_<   
  bonk   ;  Basically you want them to collide with the building. If you want them to act like bee's then think about what is really happening. A bee has a high forward velocity which updates it's position forward every frame. When it hits a window it will be reflected back - basically the velocity vector will have been reflected from the window. Then its wings will flutter like mad (applying a forward acceleration) and the bee will eventually stop moving away from the window and start going towards it again.So if you detect a collision, reflect the velocity vector and you should get the behavior you want.   