Fix CheckCollisionCircleRec() (#3584)

This commit is contained in:
ubkp
2023-11-30 06:11:45 -03:00
committed by GitHub
parent bd81bdc24a
commit e84099bfd4

View File

@ -2132,11 +2132,11 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
{ {
bool collision = false; bool collision = false;
int recCenterX = (int)(rec.x + rec.width/2.0f); float recCenterX = rec.x + rec.width/2.0f;
int recCenterY = (int)(rec.y + rec.height/2.0f); float recCenterY = rec.y + rec.height/2.0f;
float dx = fabsf(center.x - (float)recCenterX); float dx = fabsf(center.x - recCenterX);
float dy = fabsf(center.y - (float)recCenterY); float dy = fabsf(center.y - recCenterY);
if (dx > (rec.width/2.0f + radius)) { return false; } if (dx > (rec.width/2.0f + radius)) { return false; }
if (dy > (rec.height/2.0f + radius)) { return false; } if (dy > (rec.height/2.0f + radius)) { return false; }