Deleting ODE Objects in scene
Hello!
I'm trying to delete (or replace) ODE objects in my scene while my haptic simulation is running.
My ODE objects (and associated meshes) are as follows (generic code):
ODEObject = new cODEGenericBody(ODEWorld);
ODEmesh = new cMultiMesh();
ODEmesh ->LoadFromFile....;
ODEmesh->setMaterial(ODEObject);
ODEObject->createDynamicMesh(true);
I'd like to be able to press a key and have the old mesh deleted and a new mesh appear in its place. So far, I can't get the old mesh to delete from the scene.
I've tried:
ODEObject->setGhostEnabled(true);
ODEObject->disableDynamics();
ODEObject->setEnabled(false, true, true);
ODEmesh->setGhostEnabled(true);
ODEmesh->setEnabled(false, true, true);
but the haptics are still there... i.e., my haptic device still bumps into the object even though its not there graphically.
I've tried to delete/remove children, etc:
//world->clearAllComponents();
//world->deleteChild(ODEWorld); //works, but crashes
//ODEWorld->deleteChild(ODEObject);
But this doesn't work.
I feel like this should be an easy step and that I am missing something. If anyone has some advice or tips, I would be greatly appreciative.
Thanks!
J
Please Log in or Create an account to join the conversation.