🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Pixel Perfect 2D Collisions....

Started by
1 comment, last by ursus 17 years, 9 months ago
Hi people, I have written a 2D scrolling engine....hooray....at the moment the collisions detection is bounding box only....When I get a bounding box collision I want to be able to examine the textures to see if the pixels/texels overlap...can this be done or is there a better way for pixel perfect collisions?? Thanks in advance for any help!
Advertisement
Short answer : yes

Easy answer : no, cheat, everybody does, and you can hide it with stunning effects if you can.
Use multiple bounding boxes to aproximate the shape of the texture

Complicated answer : yes, you can use the GL_ARB_occlusion_query extension in cojuntion with alphatesting to check if some pixels are occluded or not, personally i have never used it since it has little use as everybody are still cheating.
Hi

Perhaps this article may be of interest to you:


http://www.gamedev.net/reference/articles/article754.asp


Although after I'd read it I managed to understand the idea I've never managed to implement it myself (perhaps I didn't spend enough time on it) or find some good examples of implementation.

Actually, the whole section of articles on the Collision Detection would be worth reading.

I'd also agree with lc_overlord. Cheat as much as you can saving lots of developement time. Players would not notice it in the heat of battle and surely won't appreciate the effort in most cases. :)

This topic is closed to new replies.

Advertisement