SFML community forums
Help => Graphics => Topic started by: dotty on February 15, 2012, 08:19:11 pm
-
Hello, I know I can use IntRect() which have some decent methods for working out collisions between them. How would I go about doing this with circular shapes?
-
Collision between circles is the simplest thing that you can do. Check if the distance between the centers is less than the sum of both radiuses, and that's it.
-
Something like:
if((x1 - x2)^2 + (y1 - y2)^2 < (radius1 + radius2)^2)
youhavecollision();
Where x and y is the position of the center of each circle.
That's pseudo-code of course but I think you can get the idea. :P