Re:How I implemented 2D collision detection in Pistol Slut
by T-hawk on Wednesday January 19, 2011 @10:43AM
(#2120037)
You can insert object A to just the 4 squares, but you still need to check with collisions with objects in all 8 surrounding squares. There could be an object B whose top-left point is in the square northwest of A's square but still collides with A.
edit: mrcharles in the child comment has it right, testing 4 squares is sufficient. In this case you will detect the collision from B's point of view instead of A's which is fine.
Re:How I implemented 2D collision detection in Pistol Slut
by mrcharles on Wednesday January 19, 2011 @10:52AM
(#2120080)
Unless I'm misunderstanding the algorithm, this is still handled with my suggestions, since you'd only test collisions against people in the same container as yourself, and someone who is northwest will be inserted in to my container regardless.
(Also, a quadtree would be more efficient for this kind of solution).
(edit for another little thing I missed)