optimize (#4065)
This commit is contained in:
parent
df849d2fb0
commit
fca53c7799
@ -2233,9 +2233,10 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
|
||||
float dx = center2.x - center1.x; // X 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user