Pixel Collisions

Started by
0 comments, last by Rob Loach 18 years, 6 months ago
How do I check the pixel colour or alpha for a sprite drawn in direct3D (ie a textured rectangle)? I have managed to detect collisions with a bounding rectangle but I would like to check for pixel collisions to be more accurate.
Advertisement
I believe what you're looking for is Pixel Perfect Collision Detection.

You pretty much make a new texture containing the masks of the overlapping textures anded together and then check if any of the new texture is white [wink]. I would recommend taking a look at TANSTAAFL's article.

You should be aware that this method is extremely slow. If available you should take a different approach to checking collisions, like a circle collision check or a sized bounding box depending on the shape of the geometry you're working with.
Rob Loach [Website] [Projects] [Contact]

This topic is closed to new replies.

Advertisement