Sign in to follow this  

dynamic collision detection(2d)

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

This topic is 3746 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this