Jump to content
  • Advertisement
Sign in to follow this  
avgprogramingjoe

dynamic collision detection(2d)

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

Hey guys, I am trying to make a class that detects collision for n amount of entities. I am having trouble figuring out how to do this. I was thinking something around:
class collision
{
    public:
        void add_entity(SDL_Rect);   // adds entity
        int check_collision(SDL_Rect);   // returns int based on collision, and where
}
But I'm not sure how to impliment it, any suggestions, tips, tutorials, etc. would be greatly appreciated. Joe

Share this post


Link to post
Share on other sites
Advertisement
You may be interested in the two N Tutorials on the topic -- Basic Collision Detection and Response and Grid-Based Collision Detection and Raycasting -- the second of which is probably more relevant to your current problem. The in-text snippets and provided sample code are in ActionScript but shouldn't be overly difficult for you to follow, and the actual explanations are quite well written. Check out the reference links at the bottom of the articles as well.

There are also a number of collision detection articles here at GDNet, but I've not read them and so can't recommend any in particular or comment on their quality or relevance.


Hope that helps. [smile]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!