Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The solution is to use ContactManager classe

physics::ContactManager *contactManager =
 this->model->GetWorld()->GetPhysicsEngine()->GetContactManager();

for(int i=0; i<contactManager->GetContactCount(); i++)
{
    physics::Contact *contact = contactManager->GetContact(i);
    cout << "contact between "<<contact->collision1->GetLink()->GetName()<<" and "
    << contact-> collision2-> GetLink()->GetName() <<endl;          
}