From c6b2a8c28352e5242a3a6b222853b0e23d0b4569 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 28 Oct 2024 16:06:46 -0500 Subject: [PATCH] fix turn speed framerate dependent --- src/game.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game.c b/src/game.c index c353e71d..6c2d8f5d 100644 --- a/src/game.c +++ b/src/game.c @@ -184,13 +184,14 @@ INTERNAL void spawn_test_entities(f32 offset) //e->control_force = 5000; e->control_force = 250; #endif - e->control_turn_speed = 10; + //e->control_turn_speed = 10; + e->control_turn_speed = 1; e->control.focus = V2(0, -1); entity_enable_prop(e, ENTITY_PROP_PHYSICAL); - e->mass_unscaled = 50; + e->mass_unscaled = 10; //e->inertia_unscaled = F32_INFINITY; - e->inertia_unscaled = 100; + e->inertia_unscaled = 10; e->linear_ground_friction = 200; e->angular_ground_friction = 100; @@ -1535,9 +1536,8 @@ INTERNAL void game_update(struct game_cmd_array game_cmds) } { - /* TODO: Why is 25 working here? */ f32 inertia_scaled = ent->inertia_unscaled * math_fabs(xform_get_determinant(xf)); - joint_ent->motor_joint_data.max_torque = (25 * PI * inertia_scaled) * ent->control_turn_speed; + joint_ent->motor_joint_data.max_torque = ((1.f / dt) * (PI / 2) * inertia_scaled) * ent->control_turn_speed; } /* Solve for final angle using law of sines */