• Advertisement

Archived

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

Guest Anonymous Poster

Analyzing Pixels in DX 7 for Collision Detection

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

That sounds like a good method for detection, it would take longer if they didnt collide, but this is only the case if they first had a bounding box collition.
I can't help you with the question about examining the pixels becasue I don't use VB. There should be some help in the examples. Try the one that does the blur.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I am developing a Isometric 2D RPG/Adventure hybrid engine using VB 6.0 and DirectX 7.0 and have a question about collision detection.

I am currently using bounding box collision detection (using the IntersectRect API call) as a first pass detection mechanism, but would like to follow that up with pixel detection.

My first idea is to pass the union RECT returned by the IntersectRect API call to each of the colliding objects and have them 'analyze' their bitmaps to see if they have only transparent pixels in the passed RECT (in my system translating the numbers in the returned RECT to coordinates on the object's bitmap is simple).

While this would work, it would actually take more time when the two objects don't collide than it would if they did (since the method could return false as soon as it identified a non-transparent pixel). On the other hand, the method would only have to analyze the small union RECT - not the entire bitmap - so the performance issue may be inconsequential.

I would appreciate comments on this idea. Also, how do you 'analyze' the properties of a particular pixel on a DirectDraw surface (to determine if it is transparent)?

Share this post


Link to post
Share on other sites

  • Advertisement