Simply Grasping Collisions and Contacts

Started by
17 comments, last by BennettSteele 11 years, 11 months ago
I have spent numerous hours and days trying to grasp these... Starting with a wonderful idea or theory, but then i start to think of scenarios for that theory, and it falls apart. I know it is abstract, and I can see how it would be that way... but I cant figure out how to calculate simply when 2 boxes are touching. I have a lot of graph paper with theorems and ideas, but i only have one uploaded since it was the most concrete, but still didnt work out... (in attachments)

So im wondering... can simple 2D box collisions be simple? Or am I taking it too lightly?
Advertisement
I'm not sure from your drawing, are you trying to compute box/box collision onlu from the corners and velocity rays ?
have you considered the fact that your collider can be a smaller object than the box ?
you need to consider edges crossing as well.
also, intersection, collisions, and response are three different things.
intersection doesn't consider movement, "collision" suggests a sweeping volume, response is "physics"
maybe that'll lead you to a more structured thinking :)
http://en.wikipedia.org/wiki/Separating_axis_theorem ?
Yeah, thats one of the reasons why it fell apart. I know everything but the process of actually detecting collisions (which is not much). I have been trying to basically memorize and understand completely how one would go about collision resolution. I know there are a lot of pages on how to detect them, like Hodgman's link, but I am talking about a more in-depth, explanation of every single little step there is and why that step is there. I just got done reading this book:
http://www.amazon.com/Physics-Engine-Development-Second-Edition/dp/0123819768

But it did not explain why some of the steps were in there, but rather just described what it did. If there are any resources on collision detection and that fit what I stated before, please post. :P

Also, I hope I am not the only one having trouble with this. Hopefully this can help anyone else who too has the same problems. :)
Also, my drawing shows my thinking of how to detect collisions or contacts by checking velocities. If you want to know more about it, please ask. It is my best "Theory" (I guess you could call it), because none of my other ones have lived to make it too code. But it does not work, because smaller object than it wont collide.
I gather from your diagrams that you're talking about collisions between 2D axis-aligned boxes moving in any direction? It sounds like you understand a fair bit of it from reading papers etc. Are the specific areas that you're stuck on?
Basically understanding why the steps of collision detection need to be there. And yes, it is 2D. But i plan on also using it for my 3D game since it wont need rotation physics. But im stuck on the steps of collision detection.
Whether it's complex depends a lot upon what your expectations are. Here's a few examples:

1. Detect whether two boxes are intersecting at a specific moment of time: Easy.
intersecting = (b1.left < b2.right) and (b1.right > b2.left) and (b1.top < b2.bottom) and (b1.bottom > b2.top)
2. Detect whether two boxes may have collided (e.g. swept out the same area within delta time d): Medium
intersecting = does polygon swept out by b1 within time d intersect with polygon swept out by b2 within time d
3. Detect whether two boxes did collide (excludes swept out same area but missed): Medium-hard
intersecting = find a time t such that the conditions in 1 are all met, taking velocity into account. Umm... take a look at this:
http://en.wikipedia....inear_equations

Those may not be the best options, just what occurred to me. Generally it is assumed that the timestep and speed of objects is such that you wouldn't need to go further than step 2. If objects move that fast or are that small it is hard for a player to interact with them.
My expectation, or what I need is an impulse based collision system, and possibly later include rotation. But as it seems, I really suck at collision programming. :-\

Mainly I am hoping to come across a nice article on basic collision resolution, that describes each step and why that step is needed. For some reason, I cant utilize a strategy without knowing why it is...
No need to put yourself down yet; there's always time later. wink.png

I'm not aware of such an article off the top of my head (not to say it doesn't exist). Just for starters, did my post on how to detect if there was a collision make sense? I can explain in more detail.

This topic is closed to new replies.

Advertisement