title: Collision Detection: What side was hit? [Java,Slick2D]
body: <p>I have two rectangles, r1 which is moving, and r2 which is a stationary tile. I need to know what side of r2 (or r1) is hit to determine which direction r1 should go. The collision detection works with the shape.intersects(otherShape), unfortunately this means that r1 will "Sink" a few pixels inside of r2. This is very problematic when dealing with the corners of the rectangles since this will cause two sides of each rectangle to intersect, thus making figuring out what side was hit by checking what side intersects which to be ineffective.</p>
  
  <p>What we know:</p>
  
  <ul>
  <li>Positions and Center positions of r1 and r2 </li>
  <li>Velocities and speeds of r1 and r2</li>
  </ul>
  
  <p>So given that information, i need an algorithm that is able to get the side of collision.</p>