change epa validity_epsilon as a temporary fix for unstable rounded edge collisions

This commit is contained in:
jacob 2025-05-16 13:24:25 -05:00
parent f4c8264c96
commit c895c9e617

View File

@ -7,7 +7,7 @@
#define COLLISION_TOLERANCE 0.005f #define COLLISION_TOLERANCE 0.005f
/* NOTE: Should always be less than tolerance, since colliding = true if origin is within this distance. */ /* NOTE: Should always be less than tolerance, since colliding = true if origin is within this distance. */
#define MIN_UNIQUE_PT_DIST_SQ (0.0001f * 0.0001f) #define MIN_UNIQUE_PT_DIST_SQ (0.001f * 0.001f)
/* To prevent extremely large prototypes when origin is in exact center of rounded feature */ /* To prevent extremely large prototypes when origin is in exact center of rounded feature */
#define MAX_EPA_ITERATIONS 64 #define MAX_EPA_ITERATIONS 64
@ -384,6 +384,7 @@ INTERNAL struct epa_result epa_get_normal_from_gjk(struct collider_shape *shape0
#if COLLIDER_DEBUG #if COLLIDER_DEBUG
{ {
/* If debug step count is reached, we still want to inspect the normal at the step */
normal = v2_norm(dir); normal = v2_norm(dir);
closest_feature.a = closest_a; closest_feature.a = closest_a;
closest_feature.b = closest_b; closest_feature.b = closest_b;
@ -399,7 +400,8 @@ INTERNAL struct epa_result epa_get_normal_from_gjk(struct collider_shape *shape0
{ {
/* NOTE: Changing this value affects how stable normals are for circular colliders */ /* NOTE: Changing this value affects how stable normals are for circular colliders */
//const f32 validity_epsilon = min_unique_pt_dist_sq; /* Arbitrary */ //const f32 validity_epsilon = min_unique_pt_dist_sq; /* Arbitrary */
const f32 validity_epsilon = 0.00000000001f; /* Arbitrary */ //const f32 validity_epsilon = 0.00000000001f; /* Arbitrary */
const f32 validity_epsilon = min_unique_pt_dist_sq; /* Arbitrary */
struct v2 vam = v2_sub(m.p, closest_a.p); struct v2 vam = v2_sub(m.p, closest_a.p);
struct v2 vbm = v2_sub(closest_b.p, closest_a.p); struct v2 vbm = v2_sub(closest_b.p, closest_a.p);