From 9981b600a8e4393807397dee5246edd0764d1fb6 Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 3 Jan 2025 16:04:32 -0600 Subject: [PATCH] draw debug movement for kinematic objects --- src/game.c | 6 +++--- src/mixer.c | 1 + src/user.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/game.c b/src/game.c index f89bb84d..9b9d546f 100644 --- a/src/game.c +++ b/src/game.c @@ -1812,9 +1812,9 @@ INTERNAL void game_update(struct game_cmd_array game_cmds) bullet->bullet_src = ent->handle; bullet->bullet_src_pos = rel_pos; bullet->bullet_src_dir = rel_dir; - bullet->bullet_impulse = 0.1f; + //bullet->bullet_impulse = 0.1f; //bullet->bullet_impulse = 0.25f; - //bullet->bullet_impulse = 1.f; + bullet->bullet_impulse = 1.f; bullet->mass_unscaled = 0.04f; bullet->inertia_unscaled = 0.00001f; bullet->sprite_collider_slice = STR("shape"); @@ -2075,7 +2075,7 @@ INTERNAL void game_update(struct game_cmd_array game_cmds) entity_enable_prop(decal, ENTITY_PROP_PHYSICAL_KINEMATIC); decal->linear_velocity = v2_mul(v2_norm(event->normal), 0.5f); - decal->angular_velocity = ((f32)sys_rand_u32() / (f32)U32_MAX); + decal->angular_velocity = 1 - (((f32)sys_rand_u32() / (f32)U32_MAX) * 2); } } } diff --git a/src/mixer.c b/src/mixer.c index 1285273a..b31d2af5 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -462,6 +462,7 @@ struct mixed_pcm_f32 mixer_update(struct arena *arena, u64 frame_count) /* ========================== * * Mix into result * ========================== */ + for (u64 i = 0; i < mix_pcm.count; ++i) { res.samples[i] += mix_pcm.samples[i] * desc.volume; } diff --git a/src/user.c b/src/user.c index 560ed1c9..8d62a4ea 100644 --- a/src/user.c +++ b/src/user.c @@ -967,7 +967,7 @@ INTERNAL void user_update(void) } #endif - if (entity_has_prop(ent, ENTITY_PROP_PHYSICAL_DYNAMIC)) { + if (entity_has_prop(ent, ENTITY_PROP_PHYSICAL_DYNAMIC) || entity_has_prop(ent, ENTITY_PROP_PHYSICAL_KINEMATIC)) { debug_draw_movement(ent); }