Created
June 18, 2018 08:48
-
-
Save fabriziospadaro/b9d8265226035ea5e9c046fd7499e902 to your computer and use it in GitHub Desktop.
fastest way to get if 2 circles are overlapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float dx = c2.Position.x - c1.Position.x; | |
float dy = c2.Position.y - c1.Position.y; | |
float radii = r1.Radius + r2.Radius; | |
if ((dx * dx) + (dy * dy) < radii * radii){ | |
return true; | |
} | |
else{ | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment