Difference between distance based collision and bounding box collision

Started by
13 comments, last by rXpSwiss 12 years, 8 months ago
Hi,

What is the big difference between the distance based collision detection way and the bounding box way ? I know the distance based use the right triangle to calculate the distance between the two objects therefore is it more slow but what is the plus ?
The bounding box way takes two rect and look if they are overlapping and the distance way look the distance between the two but in the end it is the same thing ?
I see it that way :
Bounding Box :
unledkb.jpg


Distance based collision :
unled2cm.jpg



What didn't I get ?

Best regards,

rXp>!<
Advertisement
The difference is that one is a spherical detection whilst the other is rectangular.
It comes down to what is best suited for the object.

The difference is that one is a spherical detection whilst the other is rectangular.
It comes down to what is best suited for the object.


Yes but the size of the sprite is still height x width size... so square... so no difference ?
In the 2-dimensional case there isn't any difference.

Edit: For clarification, there isn't any difference when testing for collision as in your example. Actual differences, however, depend upon context. Are you just testing rectangles, or do your entities represent characters? A typical humanoid shape character can be approximated in 3D space using either a cylinder (based on the distance-based collision metric) or a box (the bounding box metric), in which case the response of the system will be slightly different. However, since a cylinder projected from the side into 2D space is just a box, then there is really no difference between the two methods as long as you are only dealing in 2D.
I think with distance based collision detection you can get more accurate collisions where as with using just bounding box collision detection you can get a collision but visually you shouldn't have.

I may be wrong about this though as this is just a theory I haven't experimented too much with collision detection.

Remember to mark someones post as helpful if you found it so.

Journal:

http://www.gamedev.net/blog/908-xxchesters-blog/

Portfolio:

http://www.BrandonMcCulligh.ca

Company:

www.gwnp.ca

That is not always true, you can have a sprite that is 10 wide and 100 high, if you draw a circle around that you'll see that it's not very precise.
You usually test the distance to see if you should use more advanced detection.
So let's say I want to have collision on the head, the body and the legs : I should have 3 different sprites ?

Yes for 2D
The big benefit I can see right away (having never done this before) is the distance method should be adaptable to space simulations where you are already using distance everywhere for gravitational calculations. I assume you could also use the same method for a collision style that causes rapid deceleration rather than abrupt collision (think bubbles). Also, a brief glance around on the subject seems to indicate that distance based is very useful for soft-body objects.
The difference is that distance is circular in 2D and spherical in 3D, not square or rectangular like a bounding box.

So on your bottom example, those would be two circles. One with a radius of 2, and the other with a radius of 1. The pythagorean theorem determines the distance between the two as a linear value, instead of a vector of XYZ values, and that distance is used by checking if it's less than the sum of the radii of the two objects in question.

Bounding boxes check the XYZ independently, whereas distance combines XYZ using pythagorean resulting in the circular or spherical check.

distance.jpg
Okey I see the advantage of this way in 3D but in 2D I have no use for it ? (except for a totally round sprite)

This topic is closed to new replies.

Advertisement