What to use for collision detection

Member
Posts: 185
Joined: 2005.02
Post: #1
ok so in my 2D game I have this space ship:

[Image: before.jpg]

and I want to detect when the spaceship collides with things (which right now are just boxes). Up till now I have just been using AABBs and OBBs for collision detection between objects with fixed orientation. (I only have to calculate the bounding volumes once) The space ship can fly around and turn and stuff, and its geometry is much more complex than the rectangles I have been dealing with thus far. What should I use for the collision detection for the ship? An OBB tree? Could someone send me in the direction of a good tutorial/ powerpoint that explains whatever it is that I should use?
Quote this message in a reply
Member
Posts: 105
Joined: 2007.03
Post: #2
I was just going to post a very similar question so I figured I'd just stick it here. I too am working on collision detection in a 2d fixed coord game, and as of the moment am using boxes. I assumed that the practical route for me would be through checking pixel values in prespecified bounding areas of the texture. So first off, is this practical in opengl, and secondly how would I check those texel values(i use alpha masking where the background of the sprite is transparent so Id really just need to check whether a texel is transparent or not)?
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #3
Here's a couple of cool interactive tutorials about simple 2D collision detection if you want to do it yourself: http://www.harveycartel.org/metanet/tutorials.html
Quote this message in a reply
Member
Posts: 185
Joined: 2005.02
Post: #4
I have used those up till now.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
SAT works quite well, and is fast. What's the problem? Concavity limitations?

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #6
I used glReadPixels. But only because it was quick and easy.
Quote this message in a reply
Member
Posts: 185
Joined: 2005.02
Post: #7
Skorche Wrote:SAT works quite well, and is fast.

Well, yeah I have been using SAT. But the Spaceship is not a simple rectangle or square. I'm asking what the best way to deal with it would be.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #8
SAT works with any convex polygon, and you can decompose concave polys into convex polys.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #9
Most shooters (commercial, in arcades) use axis aligned boxes and nothing more. They usually just keep the collision zones somewhat inside the graphics, which arguably makes things more fun that per-pixel collision.

Unless you're doing something fancy like rigid bodies there's little reason to use anything more complicated as most games run so fast you won't notice a difference. In your case oriented boxes would make sense with that elongated rotating ship, but I'd use 2 overlapping OB's for that particular shape rather than a single box. Well, if you want the truth I'd probably redesign the shape a bit to accommodate 3 AAB's (or circles) but that's just me!
Quote this message in a reply
isgoed
Unregistered
 
Post: #10
Frank C. Wrote:Most shooters (commercial, in arcades) use axis aligned boxes and nothing more. They usually just keep the collision zones somewhat inside the graphics, which arguably makes things more fun that per-pixel collision.
I have to agree that this is the way to go. Collision detection is the hardest aspect of most games. Debugging it can be a real annoyance. My urgent advice is that you go with the most simplest solution. I would suggest just using boundingcircles since that is the most efficient shape to detect a collision with. I am not familiar with SAT, but if it does what you need don't try to invent the wheel for yourself (I know from experience). Also note that collision detection can take a significant amount of processing power, so keep it simple and fast.

This probably has been said in a few threads before, but it doesn't hurt to tell it again.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Optimize the collision detection alaslipknot 1 2,438 May 12, 2013 08:02 PM
Last Post: SethWillits
  Collision detection tutorial ThemsAllTook 7 22,096 Nov 5, 2011 05:20 PM
Last Post: SethWillits
  Help with Collision Detection..(i'm almost there) carmine 1 4,460 Jun 29, 2011 12:33 PM
Last Post: ThemsAllTook
  Time Delta, collision detection mk12 19 15,103 Sep 8, 2010 06:40 PM
Last Post: AnotherJake
  Collision detection for pinball game johncmurphy 0 4,623 Sep 6, 2009 02:46 PM
Last Post: johncmurphy