diff --git a/src/systems/physics/Physics.cc b/src/systems/physics/Physics.cc index 93a41a3f80..28f78e9032 100644 --- a/src/systems/physics/Physics.cc +++ b/src/systems/physics/Physics.cc @@ -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( + [&](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());