Comments on: 2D Polygon Collision Detection http://pogopixels.com/blog/2d-polygon-collision-detection/ Just another WordPress weblog Tue, 22 Jul 2014 10:00:12 +0000 hourly 1 https://wordpress.org/?v=4.7.9 By: Kyle http://pogopixels.com/blog/2d-polygon-collision-detection/comment-page-1/#comment-13529 Mon, 25 Jul 2011 17:16:53 +0000 http://pogopixels.com/blog/?p=10#comment-13529 The method described here is flawed. Using the test case provided it appears to work.

You can picture the problem like so: Use two squares that are orientated the same way as your polygons Have one move diagonally a large distance (twice it’s width/height up and to the right). Using this method it creates an imaginary box with the same alignment that encompasses the first box’s entire path. Placing the second box so that it touches any part of the imaginary box, regardless of the path of the first, will register a collision. This is because the profiles of the shapes, extended by the velocity, still overlap in each direction.

I also demonstrated the broken nature of the code by adding additional key bindings for diagonal movement and trying to move diagonally around the other shapes.

A correct collision detection method can be found in the quake 3 engine source code in cm_trace.c (I think). The difficulty is that while it is a technically a complete solution it is written specifically for tracing a axially aligned box against other 3d polygons. It is also heavily optimized for this purpose making it difficult to understand.

]]>
By: Well http://pogopixels.com/blog/2d-polygon-collision-detection/comment-page-1/#comment-12218 Tue, 14 Jun 2011 23:24:25 +0000 http://pogopixels.com/blog/?p=10#comment-12218 Well that didn’t work!

When two polygons are alongside each other but not colliding it registers as a collision.

]]>
By: Andreas Kröhnke http://pogopixels.com/blog/2d-polygon-collision-detection/comment-page-1/#comment-1919 Wed, 01 Jul 2009 21:00:20 +0000 http://pogopixels.com/blog/?p=10#comment-1919 This information on how to implement SAT really helped me a lot! I have been stuck for several days on my implementation of it for my iPhone game. Thanks a bunch! 🙂

]]>