small tweak
This commit is contained in:
parent
bd237e211b
commit
17f7e3daaa
11
src/game.c
11
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) {
|
||||
if (entity_has_prop(child, ENTITY_PROP_IMPULSE)) {
|
||||
acceleration = v2_add(acceleration, child->force);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user