Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Analyzing Pixels in DX 7 for Collision Detection


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 02 October 1999 - 09:26 AM

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)?


Sponsor:

#2 Pseudo   Members   -  Reputation: 100

Like
Likes
Like

Posted 02 October 1999 - 09:26 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS