Implemented float hitbox_x_depth

This commit is contained in:
CobaltXII
2019-01-01 12:10:18 -05:00
parent a9f0a786ce
commit 302a741764

View File

@@ -42,3 +42,19 @@ inline bool hitbox_intersect(hitbox a, hitbox b)
(a.z <= b.z + b.zr && a.z + a.zr >= b.z)
);
}
// Get the X depth of two intersecting hitboxes.
#define eps 0.00128f
float hitbox_x_depth(hitbox a, hitbox b)
{
if (a.x + a.xr > b.x + b.xr)
{
return (b.x + b.xr) - a.x + eps;
}
else
{
return b.x - (a.x + a.xr) - eps;
}
}