Problem with removing rigid bodies
Posted: Fri Nov 21, 2014 12:50 am
I have my simulation working just like it should it created the world, creates rigid bodies and adds them and does all the collision checks properly. The issue I am having however comes when I try to remove rigid bodies for some reason it always results in a crash. I've tried tons of different things, read over lots of examples but the result is always the same does anyone have any ideas of why this might be happening?
Crash Log
20:00:44] [debug] #0 02d97c71 in btCollisionObject::getBroadphaseHandle () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #1 02d94886 in btCollisionWorld::removeCollisionObject () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #2 02d5d80c in btDiscreteDynamicsWorld::removeRigidBody () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #3 02cfd8fb in ColAndreasMapObject::~ColAndreasMapObject () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #4 02cffa8b in ColAndreasMapObject::`scalar deleting destructor' () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #5 02d07e23 in ObjectManager::removeObjectManager () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #6 02cf70e1 in CA_DestroyObject () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
Code: Select all
for (uint16_t i = 0; i < sphereShape.size(); i++)
{
collisionWorld->removeRigidBody(sphereRigidBody[i]);
delete sphereRigidBody[i];
delete spherePosition[i];
delete sphereShape[i];
}
for (uint16_t i = 0; i < boxShape.size(); i++)
{
collisionWorld->removeRigidBody(boxRigidBody[i]);
delete boxRigidBody[i];
delete boxShape[i];
delete boxPosition[i];
}
if (HasMesh)
{
collisionWorld->removeRigidBody(meshRigidBody);
delete meshRigidBody;
delete meshshape;
delete meshposition;
delete trimesh;
}
20:00:44] [debug] #0 02d97c71 in btCollisionObject::getBroadphaseHandle () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #1 02d94886 in btCollisionWorld::removeCollisionObject () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #2 02d5d80c in btDiscreteDynamicsWorld::removeRigidBody () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #3 02cfd8fb in ColAndreasMapObject::~ColAndreasMapObject () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #4 02cffa8b in ColAndreasMapObject::`scalar deleting destructor' () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #5 02d07e23 in ObjectManager::removeObjectManager () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL
[20:00:44] [debug] #6 02cf70e1 in CA_DestroyObject () from E:\mainbackup2\Saved SAMP Installs\03z_test\plugins\colandreas.DLL