Sign in to follow this  
csuguy

Collision Detection

Recommended Posts

Hey all, I'm looking for ideas on how to do a collision detection manager. You see, I have to develop a pool game. Now, for a simple game like pong the collisions are easy enough - because u really only have to check collision for 1 object. But with pool I obviously have a number of balls I need to keep track of. I expect I'll need a way to detect all of the collisions before I move the balls... I'm just not sure exactly how to do this. So if anyone knows a good method for this sort of collision detection let me know! Thanks! Ryan

Share this post


Link to post
Share on other sites
most collision detection algorithms work like this.

Find colliding pairs of objects,
calculate resulting force
repeat for all objects in the scene,
update position of all objects
render

Share this post


Link to post
Share on other sites
I'm making a pongish breakoutish type of game with multiple balls and use a similar approach. Here is a good resource on ball collision.

Another issue to keep in mind is when the order they collide in. If both balls B and C collide with ball A, you need to figure out which one hit first (let's say it was B), calculate the vector that C would be on after that point in time (same vector but the position is updated and the length of the vector will be smaller), and recalculate to see if there is still a collision between A and C, going from there. Etc. There are quite a few nuances involved with physics and dynamic collision detection which is why there are so many libraries to handle these things now-a-days. Have fun!

Cheers
-Scott

Share this post


Link to post
Share on other sites

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