take mass to account when applying impulse
This commit is contained in:
parent
10c9c833ba
commit
9a2ec4ebe4
@ -589,7 +589,8 @@ INTERNAL void game_update(struct game_cmd_array game_cmds)
|
|||||||
/* Apply impulses */
|
/* Apply impulses */
|
||||||
for (struct entity *child = entity_from_handle(store, ent->first); child->valid; child = entity_from_handle(store, child->next)) {
|
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)) {
|
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);
|
entity_enable_prop(child, ENTITY_PROP_RELEASE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user