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;
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!