Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Collision system class(es)

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

Ok, i have my own classes: Sprites, Layers, and particles. How would i approach having a collision class that could be any of these and be able to collide with everthing else? (using C++ by the way) It would help if I could work with someone one-on-one through a chat to help me create a collision system :)

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by EvilKnuckles666
Ok, i have my own classes: Sprites, Layers, and particles. How would i approach having a collision class that could be any of these and be able to collide with everthing else? (using C++ by the way)

It would help if I could work with someone one-on-one through a chat to help me create a collision system :)
I'm not much of software engineer per se, but collision detection (especially from a generic perspective) is of particular interest to me. I will say that the first step in designing such an architecture is to establish (in some detail) what exactly you want your collision system to do. I gather it's 2d-only (which simplifies things nicely). From there, some questions you might ask are:

1. Do you just need a boolean result, i.e. are two objects intersecting, or...
2. Do you also need information that will help to resolve the collision?
3. What about movement? Will the objects be moving slowly enough that static tests alone will suffice?
4. Or do you need continuous collision detection as well?
5. What other sort of feedback do you need? For example:
6. Contact normals are useful for collision resolution, and...
7. Contact points are useful for physics simulation.
8. Are you going to be dealing with enough objects that broad-phase culling will be required? And if so:
9. How many objects on average will there be, and what is the range of objects sizes?
10. How big of a factor is performance? Is it more important that the intersection functions be fast or general?
11. What sort of shapes do you want to support? Circles? Rectangles? Arbitrary convex polygons?
12. What sort of algorithms do you want to use? Pixel-perfect? SAT?

And so on. It seems like a lot of questions, but in the process of designing your collision detection system you'll have to answer all of them (and probably more) sooner or later. Note however that just because there are a lot of things to consider, that doesn't mean the system itself has to be incredibly complicated or difficult to implement; it may be that you'll end up with something very simple.

As for the details of how to build your class hierarchy, that will depend largely on the answers to the above questions. Anyway, I hope this will at least give you a little food for thought.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!