ephysics: activate all bodies when one is deleted

Otherwise it can lead to scenarios when a body 1, below body 2 is deleted
and body 2 will stay freezed in the air. Gravity won't start to
act over it until it's activated again.



SVN revision: 76155
This commit is contained in:
Bruno Dilly 2012-09-04 22:42:35 +00:00
parent d42b1c51c2
commit 35780ad7cf
1 changed files with 11 additions and 0 deletions

View File

@ -360,6 +360,7 @@ Eina_Bool
ephysics_world_body_del(EPhysics_World *world, EPhysics_Body *body)
{
btSoftBody *soft_body;
EPhysics_Body *bd;
if (world->walking)
{
@ -379,6 +380,16 @@ ephysics_world_body_del(EPhysics_World *world, EPhysics_Body *body)
world->bodies = eina_inlist_remove(world->bodies, EINA_INLIST_GET(body));
ephysics_orphan_body_del(body);
/* Activate all the bodies after a body is deleted.
Otherwise it can lead to scenarios when a body 1, below body 2 is deleted
and body 2 will stay freezed in the air. Gravity won't start to
act over it until it's activated again. */
EINA_INLIST_FOREACH(world->bodies, bd)
{
btRigidBody *rigid_body = ephysics_body_rigid_body_get(bd);
rigid_body->activate(1);
}
return EINA_TRUE;
}