Stack of bodies, won't activate

rasarasa
Posts: 2
Joined: Mon Aug 16, 2010 7:42 pm

Stack of bodies, won't activate

Post by rasarasa »

Hi!

I have a stack of dynamic boxes. They are created with a small space between them. After creation they fall down like they should and then enters sleep mode. But when I remove any of the boxes, the ones above the removed box stays in sleep mode, and thus hover in the air.

I have read many of the posts containing problems similar to mine, and the solution presented involves activating the body before removal, so that the bodies around it would be updated, but that does not activate any of the bodies in the stack in my case.

Code: Select all

body->activate(true);

mDynamicsWorld->removeRigidBody(body);
delete body->getMotionState();
mRigidBodies.remove(body);
delete body;
I even tried to activate the due to be removed body several updates before deletion, but that didn't change anything except that activating any of the now hovering boxes activate the whole hovering stack, making it fall (like it should have, when the first box were deleted).

So just to recap: Activating a body in a stack that rests on the floor does not activate the other bodies, but activating a body in a stack that sleep in the air activates the whole stack (like it should be).

Another solution presented in a similar topic, was to activate all the boxes in the stack, but I don't have any idea on how to know which bodies should be activated. I read something about islands (which what I understand, are groups of close objects from the broadphase) but searches on the subject didn't make anything clearer, on how to get a list of those bodies.

Does any one have a solution to this problem? Since none of the similar topics seemed to have a working solution.

These are the bullet classes I'm using:
btDbvtBroadphase
btDefaultCollisionConfiguration
btCollisionDispatcher
btSequentialImpulseConstraintSolver
btDiscreteDynamicsWorld

Bullet version 2.76

Thanks in advance!
rasarasa
Posts: 2
Joined: Mon Aug 16, 2010 7:42 pm

Re: Stack of bodies, won't activate

Post by rasarasa »

After doing some more debugging, I realized that activating the due to be removed body, sets the other bodies in "Want deactivation". But when the body is removed, the other bodies becomes deactivated, immediately (because every body is in "want deactivation" state), but shouldn't the body at the bottom realize that there is nothing beneath it, before that?.

So activating the body before it is removed will effectively never activate the other bodies. Unsure on how to proceed with the problem now...

Any wisdom on how to fix this problem is highly appreciated :D