I have updated the ODESimulator class to provide a function to delete rigid objects from the simulation.
void ODESimulator::RemoveObject(ODERigidObject* object)
{
for ( size_t i=0; i<objects.size(); ++i )
{
if ( object == objects[i] )
{
objects.erase(objects.begin()+i);
delete object;
break;
}
}
}
One also has to delete the RigidObject from the RobotWorld object by calling RobotWorld::DeleteRigidObject().
A functional deletion procedure could then look like this:
void disposeRigidObject(ODERigidObject* object)
{
world_->DeleteRigidObject(object->obj.name); // RobotWorld* world_
simulation_->odesim.RemoveObject(object); // WorldSimulation* simulation_
simulation_->UpdateModel();
}
I wonder tho if this is safe to do?
- solved #2
- replies 2
- views 4K
- likes 0