collision detection for a circle???
I am new to collision detection with circles. I pretty much know how to do collision detection with rectangles, and i am going to start with circles. to get collision detection for 2 circles, i "think" i would find out the center point of the two circles and then find out the distance between the 2 center points of the 2 circles. Then i would subtract the sum of each circle's radius. If the remaining number is >= 0 then a collision has taken place. If not, a collision hasnt taken place.
So here's my questions:
1. how do i find out the center point of a circle?
2. how do i find out the distance between two center points of 2 circles?
3. how do i find the radius of a circle?
Thanks for any help!
Re: collision detection for a circle???
this is really old thread, found it from google, lol, but couldn't help replying,
radius is circle.width / 2
the center of a circle is (circle.left + radius, circle.top + radius)
lol 2001, i wont get a reply back, but in case anyone else finds this thread
Re: collision detection for a circle???
Quote:
Originally Posted by
dflw
I am not really making a game yet, i 'm just figuring out how to do the basics of games like collision detection.
Ok, this is your problem in a nutshell actually. You don't understand exactly what a game is (at least an arcade game) :)
A game is a program that when you start it, it runs in a loop. It zips through that loop at least 30 times a second. Every time it does, it draws the graphics on the screen. Why 30? Because that's about the minimum frames per second that the human eye is unable to perceive flickering (most game designers aim for 60 or better)
If you're used to application programming, this type of graphics control was never an issue. Things didn't "move", they just "sat". Windows only updated the graphics when something happened and handled it behind the scenes.
In a Game, the positional information of each object on the screen are CONSTANTLY being updated. Even if a circle on the screen hasn't moved for 10 seconds, the game has updated itself at least 300 times! And every time, it's checking for collision between that circle and another.
Re: collision detection for a circle???
You are aware that dflw has a "Last Activity: Mar 31st, 2002 05:52 PM".
Re: collision detection for a circle???
Arrgg... I hate it when someone necro's a thread. :mad:
Re: collision detection for a circle???
Quote:
Originally Posted by
Jenner
Arrgg... I hate it when someone necro's a thread. :mad:
sorry? lol