From 9a2ec4ebe4de62a3ba2af1296feb10ee41a98fc7 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 19 Aug 2024 19:45:12 -0500 Subject: [PATCH] take mass to account when applying impulse --- src/game.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index c1ceea81..6478c216 100644 --- a/src/game.c +++ b/src/game.c @@ -589,7 +589,8 @@ INTERNAL void game_update(struct game_cmd_array game_cmds) /* Apply impulses */ for (struct entity *child = entity_from_handle(store, ent->first); child->valid; child = entity_from_handle(store, child->next)) { if (entity_has_prop(child, ENTITY_PROP_IMPULSE)) { - acceleration = v2_add(acceleration, child->impulse); + struct v2 impulse_acceleration = v2_div(child->impulse, mass); + acceleration = v2_add(acceleration, impulse_acceleration); entity_enable_prop(child, ENTITY_PROP_RELEASE); } }