Jump to content
  • Advertisement

Archived

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

mesHead

Simple Collision Detection

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Look on these sites :
www.flipcode.com
www.gamedev.net
www.gamasutra.com
www.google.com

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!