Page 1 of 1

Deleting RigidBodies

Posted: Fri Nov 06, 2015 4:27 pm
by trying
Hello,

I have been trying deleting rigid bodies during simulation and it always crashes my application. I followed the below code.

Code: Select all

void destroyBodies(btDiscreteDynamicsWorld* dynamicsWorld, btRigidBody* body)
{
    dynamicsWorld->removeRigidBody(body);
    delete body->getMotionState();
    delete body;
}

Re: Deleting RigidBodies

Posted: Fri Nov 06, 2015 5:26 pm
by xexuxjy
Where about's does it crash exactly? do you always have a motionstate on the bodies?

Re: Deleting RigidBodies

Posted: Fri Nov 06, 2015 5:39 pm
by trying
Solved it, there was a mistake on my side related with structs.