fix turn speed framerate dependent

This commit is contained in:
jacob 2024-10-28 16:06:46 -05:00
parent 161e615aa7
commit c6b2a8c283

View File

@ -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 */