diff --git a/src/game.c b/src/game.c index 6ccef0fc..38e4b733 100644 --- a/src/game.c +++ b/src/game.c @@ -598,17 +598,14 @@ INTERNAL void game_update(struct game_cmd_array game_cmds) struct xform xf = entity_get_xform(ent); f32 mass = ent->mass_unscaled * xform_get_determinant(xf); - /* Apply forces and impulses */ + /* Determine acceleration from forces and impulses */ struct v2 acceleration = V2(0, 0); for (struct entity *child = entity_from_handle(store, ent->first); child->valid; child = entity_from_handle(store, child->next)) { - b32 is_force = entity_has_prop(child, ENTITY_PROP_FORCE); - b32 is_impulse = entity_has_prop(child, ENTITY_PROP_IMPULSE); - if (is_force || is_impulse) { - if (is_impulse) { - acceleration = v2_add(acceleration, child->force); - } else { - acceleration = v2_add(acceleration, v2_mul(child->force, dt)); - } + if (entity_has_prop(child, ENTITY_PROP_IMPULSE)) { + acceleration = v2_add(acceleration, child->force); + entity_enable_prop(child, ENTITY_PROP_RELEASE); + } else if (entity_has_prop(child, ENTITY_PROP_FORCE)) { + acceleration = v2_add(acceleration, v2_mul(child->force, dt)); entity_enable_prop(child, ENTITY_PROP_RELEASE); } }