#### Archived

This topic is now archived and is closed to further replies.

# Simple Collision Detection

This topic is 6593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! I was wondering if anyone knows where I can find some tutorials on very basic collision detection. I am VERY new at collision detection and such, so the simpler the tutorial the better. ( all I''m trying to learn is how to detect a simple collision between two 2D square polygons. very, very simplistic :D ) Thanks in advance to all those who reply. -- Keith. mesHead.

##### Share on other sites
Look on these sites :
www.flipcode.com
www.gamedev.net
www.gamasutra.com

##### Share on other sites
I will continue plugging this unitl people stop saying how good it is Collision code. It requires no math!!

Open mouth, insert foot

##### Share on other sites
Yeah, but how would you do pixel-perfect collision detection? Just wondering... Perhaps if, for every bitmap, you also have a 1-bit-per-pixel bitmap, and you AND the two 1-bit bitmaps onto a large 1-bit-deep bitmap filled with 1''s, you could see if you have any 1''s left in the resulting large bitmap.... but that would be kinda inefficient I think.

------------------------
CRAZY_DUSIK* pCrazyDuSiK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);

##### Share on other sites
You''re right, by itself it isn''t wonderfully inefficient, but you can:
i. precalculate these monochrome bitmasks for every frame of animation, but if you haven''t the memory only re-calculate them when the animation frame changes.

ii. precalculate/generate_on_the_fly a column mask - where you OR together all the rows of each column of the mask from i. This gives you a very quick check as whether you need to do the compulationaly expensive check.
This works well for objects moving horiztonally (relative to each other), for relative vertical motion generate row masks based on the columns.

Not forgetting that you can do really quick checks on intersections of bounding rectangles before any of this.

Using all of these works well, even on low performance machines such as the GameBoy Colour.

##### Share on other sites
Yeah, Beelzebub, you''re right

Unfortunately, you can''t really do that in 3D, hence there are always clipping bugs... I''m developing a 3D engine. We''ll see what can come up with, but clipping, etc. is still ways off. I mean, I just started at the end of August, and now I''m converting to DX8... I think DX8 is kinda messy. It seems simpler, but some things don''t make sense until you ponder for a while.

------------------------
CRAZY_DUSIK* pCrazyDuSiK;
pCrazyDuSiK->EatMicroshaft(MS_MUNCH_BILL_GATES | MS_CHEW_BILL_GATES);

1. 1
2. 2
Rutin
21
3. 3
A4L
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633742
• Total Posts
3013630
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!