diff --git a/src/game.c b/src/game.c index cfa01788..e70721e6 100644 --- a/src/game.c +++ b/src/game.c @@ -172,8 +172,8 @@ INTERNAL void spawn_test_entities(f32 offset) entity_enable_prop(e, ENTITY_PROP_PHYSICAL); e->mass_unscaled = 100; - e->inertia_unscaled = F32_INFINITY; - //e->inertia_unscaled = 25; + //e->inertia_unscaled = F32_INFINITY; + e->inertia_unscaled = 25; e->linear_ground_friction = 1000; e->angular_ground_friction = 100; @@ -636,7 +636,6 @@ INTERNAL void solve_collisions(f32 dt, b32 apply_bias) f32 mass_scale = 1.0f; f32 impulse_scale = 0.0f; - if (separation > 0.0f) { velocity_bias = separation / dt; } else if (apply_bias) { @@ -695,9 +694,9 @@ INTERNAL void solve_collisions(f32 dt, b32 apply_bias) f32 vt = v2_dot(vrel, tangent); f32 j = vt * k; - //f32 friction = 0.6f; + f32 friction = 0.6f; //f32 friction = 1.0f; - f32 friction = F32_INFINITY; + //f32 friction = F32_INFINITY; f32 max_friction = friction * contact->normal_impulse; f32 old_impulse = contact->tangent_impulse; f32 new_impulse = clamp_f32(old_impulse + j, -max_friction, max_friction); diff --git a/src/gjk.c b/src/gjk.c index 8aeb1ad3..e3ecd1bc 100644 --- a/src/gjk.c +++ b/src/gjk.c @@ -596,7 +596,7 @@ struct gjk_contact_points_result gjk_contact_points(struct v2_array shape0, stru struct gjk_contact_points_result res = ZI; /* TODO: Parameterize */ - const f32 tolerance = 0.005f; + const f32 tolerance = 0.0025f; const f32 min_unique_pt_dist_sq = 0.001f * 0.001f; b32 colliding = false; @@ -942,34 +942,17 @@ struct gjk_contact_points_result gjk_contact_points(struct v2_array shape0, stru } } - /* Clip */ - (UNUSED)a0; - (UNUSED)b0; - (UNUSED)vab0; - (UNUSED)a1; - (UNUSED)b1; - (UNUSED)vab1; - - - f32 a0t = -1; - f32 a1t = -1; - f32 b0t = -1; - f32 b1t = -1; - (UNUSED)a0t; - (UNUSED)a1t; - (UNUSED)b0t; - (UNUSED)b1t; + f32 a0t = 0; + f32 a1t = 0; + f32 b0t = 0; + f32 b1t = 0; struct v2 vba0 = v2_neg(vab0); struct v2 vba1 = v2_neg(vab1); - (UNUSED)vba0; - (UNUSED)vba1; { { struct v2 va0a1 = v2_sub(a1, a0); struct v2 va1a0 = v2_neg(va0a1); - (UNUSED)va0a1; - (UNUSED)va1a0; { f32 w = v2_wedge(vab0, normal); if (w != 0) {