I know what an AABB is, but I don't know how you would check for collision with an object that is going really fast. If an object goes fast enough, it can skip over other bounding boxes without it detecting a collision.

High speed object

So, for an object with a bounding box to move from (0, 0) to (525, 670) in one update, would I have to somehow iterate over each point from the starting point to the end? Because I need objects to be able to go fast and still be tested for collision on other bounding boxes. I hope that makes sense.

  • \$\begingroup\$ Is your game grid based? Generally I could recommend a very simply raycasting solution for this issue. \$\endgroup\$
    – AturSams
    Mar 12, 2014 at 12:28

1 Answer 1


The term you are looking for is "Continuous Collision Detection" (CCD), something also refered to as "Anti-Tunneling" and less commonly "Broad-phase collision detection".

Some CCD implementations rely on ray-casting approaches that cast a ray in the direction of the fast traveling object to check if there is an object in the way and try to estimate whether the next frame update could already bypass this "hit" object (based on current speed). If so the expected time of impact is calculated and the movement restricted accordingly.

Another approach often used by the physics engines (e.g. "PhysX" or "Bullet") is to not only check for collisions at the position the object currently is in (which might already be beyond the object it should have collided with), but to also do various checks between the position from the previous frame and the current one. Bullet does so by using a "swept sphere" which is used to quickly check for potential collisions along that path (a sphere is used since it is even faster to check than a box).

It is advised to only turn on CCD for fast objects since it rather performance-heavy. Therefore, in some engines you have to defined speed threshold and only once they are hit, CCD comes into play (e.g. see this Bullet setup guide).

PS: I know that the mentioned physics engines are C++ and you are asking for Java, but the principles still apply.

BTW: Also have a look at this answer, as well as this more generic / theoretical SO question on potential algorithms.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .