Skip to content

Commit

Permalink
Check if any entity actually has a ContactSensorData component before… (
Browse files Browse the repository at this point in the history
gazebosim#2474)



Signed-off-by: Shameek Ganguly <[email protected]>
  • Loading branch information
shameekganguly authored Jul 12, 2024
1 parent 90a7ba7 commit c4b55bd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/systems/physics/Physics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3794,6 +3794,18 @@ void PhysicsPrivate::UpdateCollisions(EntityComponentManager &_ecm)
if (!_ecm.HasComponentType(components::ContactSensorData::typeId))
return;

// Also check if any entity currently has a ContactSensorData component.
bool needContactSensorData = false;
_ecm.Each<components::Collision, components::ContactSensorData>(
[&](const Entity &/*unused*/, components::Collision *,
components::ContactSensorData */*unused*/) -> bool
{
needContactSensorData = true;
return false;
});
if (!needContactSensorData)
return;

// TODO(addisu) If systems are assumed to only have one world, we should
// capture the world Entity in a Configure call
Entity worldEntity = _ecm.EntityByComponents(components::World());
Expand Down

0 comments on commit c4b55bd

Please sign in to comment.