mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 03:18:14 +00:00
optimize (#4065)
This commit is contained in:
@@ -2233,9 +2233,10 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
|
|||||||
float dx = center2.x - center1.x; // X distance between centers
|
float dx = center2.x - center1.x; // X distance between centers
|
||||||
float dy = center2.y - center1.y; // Y distance between centers
|
float dy = center2.y - center1.y; // Y distance between centers
|
||||||
|
|
||||||
float distance = sqrtf(dx*dx + dy*dy); // Distance between centers
|
float distanceSquared = dx * dx + dy * dy; // Distance between centers squared
|
||||||
|
float radiusSum = radius1 + radius2;
|
||||||
|
|
||||||
if (distance <= (radius1 + radius2)) collision = true;
|
collision = (distanceSquared <= (radiusSum * radiusSum));
|
||||||
|
|
||||||
return collision;
|
return collision;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user