mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Fix CheckCollisionCircleRec() (#3584)
This commit is contained in:
@ -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; }
|
||||||
|
|||||||
Reference in New Issue
Block a user