small formatting
This commit is contained in:
parent
71e3d9f05f
commit
06afe6263f
@ -172,8 +172,8 @@ INTERNAL void spawn_test_entities(f32 offset)
|
|||||||
|
|
||||||
entity_enable_prop(e, ENTITY_PROP_PHYSICAL);
|
entity_enable_prop(e, ENTITY_PROP_PHYSICAL);
|
||||||
e->mass_unscaled = 100;
|
e->mass_unscaled = 100;
|
||||||
e->inertia_unscaled = F32_INFINITY;
|
//e->inertia_unscaled = F32_INFINITY;
|
||||||
//e->inertia_unscaled = 25;
|
e->inertia_unscaled = 25;
|
||||||
e->linear_ground_friction = 1000;
|
e->linear_ground_friction = 1000;
|
||||||
e->angular_ground_friction = 100;
|
e->angular_ground_friction = 100;
|
||||||
|
|
||||||
@ -636,7 +636,6 @@ INTERNAL void solve_collisions(f32 dt, b32 apply_bias)
|
|||||||
f32 mass_scale = 1.0f;
|
f32 mass_scale = 1.0f;
|
||||||
f32 impulse_scale = 0.0f;
|
f32 impulse_scale = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
if (separation > 0.0f) {
|
if (separation > 0.0f) {
|
||||||
velocity_bias = separation / dt;
|
velocity_bias = separation / dt;
|
||||||
} else if (apply_bias) {
|
} else if (apply_bias) {
|
||||||
@ -695,9 +694,9 @@ INTERNAL void solve_collisions(f32 dt, b32 apply_bias)
|
|||||||
f32 vt = v2_dot(vrel, tangent);
|
f32 vt = v2_dot(vrel, tangent);
|
||||||
f32 j = vt * k;
|
f32 j = vt * k;
|
||||||
|
|
||||||
//f32 friction = 0.6f;
|
f32 friction = 0.6f;
|
||||||
//f32 friction = 1.0f;
|
//f32 friction = 1.0f;
|
||||||
f32 friction = F32_INFINITY;
|
//f32 friction = F32_INFINITY;
|
||||||
f32 max_friction = friction * contact->normal_impulse;
|
f32 max_friction = friction * contact->normal_impulse;
|
||||||
f32 old_impulse = contact->tangent_impulse;
|
f32 old_impulse = contact->tangent_impulse;
|
||||||
f32 new_impulse = clamp_f32(old_impulse + j, -max_friction, max_friction);
|
f32 new_impulse = clamp_f32(old_impulse + j, -max_friction, max_friction);
|
||||||
|
|||||||
27
src/gjk.c
27
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;
|
struct gjk_contact_points_result res = ZI;
|
||||||
|
|
||||||
/* TODO: Parameterize */
|
/* TODO: Parameterize */
|
||||||
const f32 tolerance = 0.005f;
|
const f32 tolerance = 0.0025f;
|
||||||
const f32 min_unique_pt_dist_sq = 0.001f * 0.001f;
|
const f32 min_unique_pt_dist_sq = 0.001f * 0.001f;
|
||||||
|
|
||||||
b32 colliding = false;
|
b32 colliding = false;
|
||||||
@ -942,34 +942,17 @@ struct gjk_contact_points_result gjk_contact_points(struct v2_array shape0, stru
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clip */
|
f32 a0t = 0;
|
||||||
(UNUSED)a0;
|
f32 a1t = 0;
|
||||||
(UNUSED)b0;
|
f32 b0t = 0;
|
||||||
(UNUSED)vab0;
|
f32 b1t = 0;
|
||||||
(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;
|
|
||||||
|
|
||||||
struct v2 vba0 = v2_neg(vab0);
|
struct v2 vba0 = v2_neg(vab0);
|
||||||
struct v2 vba1 = v2_neg(vab1);
|
struct v2 vba1 = v2_neg(vab1);
|
||||||
(UNUSED)vba0;
|
|
||||||
(UNUSED)vba1;
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
struct v2 va0a1 = v2_sub(a1, a0);
|
struct v2 va0a1 = v2_sub(a1, a0);
|
||||||
struct v2 va1a0 = v2_neg(va0a1);
|
struct v2 va1a0 = v2_neg(va0a1);
|
||||||
(UNUSED)va0a1;
|
|
||||||
(UNUSED)va1a0;
|
|
||||||
{
|
{
|
||||||
f32 w = v2_wedge(vab0, normal);
|
f32 w = v2_wedge(vab0, normal);
|
||||||
if (w != 0) {
|
if (w != 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user