Fix CheckCollisionCircleRec() (#3584)
This commit is contained in:
parent
bd81bdc24a
commit
e84099bfd4
|
|
@ -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; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user