Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Just curious what might be a good way to implement a decent collision system. As a class inherited by a base Entity class? Currently I'm stuck and could just use a couple better ideas than my own.

Any help is appreciated!

Edit: Sorry, it's 2D Collisioning but honestly, I'm not looking for specific collision methods. I'm looking more about the lines of implementation. Just curious of some of the common methods of how to implement collision systems such as:

Should the entire collision system be it's own class? What, if anything, should be inheritable?

These are some of my questions. Sorry for the confusion.

share|improve this question
    
Please add some additional information about what you want to achieve. Do you need 2D or 3D collision detection? How many objects will have to be checked? What precision do you need? –  sum1stolemyname Jan 3 '11 at 9:23
add comment

2 Answers

up vote 5 down vote accepted

Each time I ask about collision systems, discussions (online) goes this way :

  • "Hey how should I do this kind of collision?"
  • "You should try this algorithm."
  • "No, this one algorithm would be better!"
  • "Maybe a more global view of the system would help, like using this algorithm."
  • "Just get the Real Time Collisions book and shut up."

So after several discussions like that I finally bought the book : http://realtimecollisiondetection.net/

It presents all aspects of the subject to inform you enough to let you decide what to do for each case.

share|improve this answer
    
Thank you for enlightening me. Honestly I've found plenty of resources on different algorithms. Just having idea block on exactly how to implement in a semi-efficient/realistic way. Again thanks. –  hrr4 Jan 3 '11 at 10:21
    
No problem, I've been through the same questions again and again and now that I got this book I have a solid reference to work on immediately. –  Klaim Jan 3 '11 at 12:42
add comment

This is a question of design approach, so there is no single optimal solution.

A possible approach would be to create a superclass for collidable objects which defines functions for collision detection and have all collidable-object classes inherit from this class.

How these functions work is dependent on other parameters, such as the type of collision detection (bounding box, bounding circle, bounding polygon, per pixel, ...).

share|improve this answer
    
Hrm, thank you for the input. Yea, from what I've found and for what I'm trying to achieve (asteroids clone), I've decided on a circle-circle->AABB type system. But again, was just looking for implementation ideas. Hitting idea blocks and just reaching out for a bit of help :). Thanks! –  hrr4 Jan 3 '11 at 10:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.