Jump to content
  • Advertisement

Archived

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

Junghans

Collision detection

This topic is 6320 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

Hello world ! I would like to know how to detect 2d colision with pixel level... Can someone explain me how to do it ??

Share this post


Link to post
Share on other sites
Advertisement
Well pixel perfect collision detection is fairly simple. In this instance let''s say we have a 32x32 tile, and a 64x64 character. Now because testing each pixel for a collision is extremly slow especialy when done on a large scale you should first do a bounding box test. If my 64x64 character has hit the location of the 32x32 tile, then it''s time for us to check the pixels. Now in this instance both our 32x32 tile & 64x64 tile use RGB 0,0,0 for the transparent color. So now we test each pixel in our 32x32 tile & 64x64 tile until the RGB color isn''t 0,0,0. Once this happens you have a collision.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!