From Processing
| Versions:
| 1.0+
|
| Contributors:
| neko
|
| Started:
| 2007-08-21
|
This will check if two circles collide. It's less efficient than a rectangle collision. It is essentially seeing if the distance between the circle centers is greater than the sum of the radii.
Source Code
/**
* Check if two circle collide
* x_1, y_1, radius_1 defines the first circle
* x_2, y_2, radius_2 defines the second circle */
boolean circle_collision(float x_1, float y_1, float radius_1, float x_2, float y_2, float radius_2)
{
return dist(x_1, y_1, x_2, y_2) < radius_1 + radius_2;
}
Downloads
Related Links