ConnectDeleteEntity event doesn't work in World Plugin
Hello everybody,
I want to make a world plugin with events callback, everything work perfectly except the ConnectDeleteEntity event. With the following code, when we create a model, we get a "Add" message (the function "OnAddEntity" is called) but when remove a model (for example, by selecting a model and pressing the Delete Key, or with the menu), the function "OnDeleteEntity" is not called.
namespace gazebo{
struct PluginGazebo : public WorldPlugin {
//----------------------------------
event::ConnectionPtr DeleteEntityConnection;
event::ConnectionPtr AddEntityConnection;
//----------------------------------
void OnDeleteEntity(const std::string str){
std::cerr << "Delete " << str << std::endl;
}
//----------------------------------
void OnAddEntity(const std::string str){
std::cerr << "Add " << str << std::endl;
}
//----------------------------------
virtual void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf){
//--
this->DeleteEntityConnection = event::Events::ConnectDeleteEntity(boost::bind(&PluginGazebo::OnDeleteEntity, this, _1));
this->AddEntityConnection = event::Events::ConnectAddEntity(boost::bind(&PluginGazebo::OnAddEntity, this, _1));
}
};
GZ_REGISTER_WORLD_PLUGIN(PluginGazebo)
}
When OnDeleteEntity should be called ?
Thanks.