   2D Collision detection with velocity
  I'm sorry to ask this because it has probably been asked at least a thousand times already but I couldn't figure out any good keywords to use when searching google. All I could find was how to apply proper velocity reduction AFTER collision ( i.e ellasticism(sp?) ).Anyway I am looking for a tutorial, code snippet (C++/C) or other on how to deal with 2D bounding box collision detection that takes velocities into consideration. For instance how to determine if two objects collided "between" two game ticks.The first problem is just to determine if the objects' movement paths overlap. This is easy as long as they aren't moving diagonally, but then I really don't know what to do?The second problem is a bit more difficult, and I don't think I will need collision detection as precis as this but if there are tutorials about it I would be happy to take a look at them :) Anyway here comes the problem:Say I have an object1 at position (x,y) and another object2 at (x+10,y-10). Next game tick object1 has moved to position (x+11,y) and object2 has moved to (x+10,y+10).Both objects' movement paths overlap, but is is still not ceratain that a collision occured because object2 moves at a higher speed/velocity (which one to use?) than object1 (20 pixels/tick as compared to 11 pixels/tick) and so object2 might have already been at its destination before object1 has reached the point where their paths overlap.Thanks in advance   
  This problem can be simplified by always using one of the objects as reference frame and not world coordinates. This meens that in your example object2 moves from position (x+10, y-10) - (x,y) = (+10, -10) to (x+10,y+10) - (x+11,y) = (-1, +10) using object1's coordinates as reference point. To determine if object1 and object2 collides during the game tick is to determine if object2 passes through origo (object1), using object1's coordinateframe.I.e. does boudingbox moving from (+10, -10) to (-1, +10) pass through boundingbox at (0, 0).;  Well, over the course of that time interval, each object will trace out a line. What you need to do is take the general equation for motion for each object, and solve them as an inequality.For instance, object 1 starts at position x1 and moves at velocity v1. The motion equations are:x'1 = x1 + v1tx'2 = x2 + v2tWhat you need to do is solve to find the smallest t that gives you a condition where ||x'1 - x'2|| <= r1+r2If the solutions are less than 0 or greater than your timestep, then there is no collision.If there are, then rewind your game to that time, correct the collision, and move forward again.   ;  There are a couple of articles in the 'collision detection' articles section on this site that cover swept (that is, taking velocities into account) intersection for both oriented and axis-aligned boxes. I can't remember the article names, but I think one of them is by Gomez. These should have the algorithms you're looking for.   