Skip to content

Commit 36be1c6

Browse files
authored
Properly clear the sensors from the scene (#2001)
1 parent 961b0a1 commit 36be1c6

File tree

1 file changed

+4
-0
lines changed
  • plugins/robots/common/twoDModel/src/engine/model/physics/parts

1 file changed

+4
-0
lines changed

plugins/robots/common/twoDModel/src/engine/model/physics/parts/box2DRobot.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ Box2DRobot::~Box2DRobot() {
7373
for (auto i = 0; i < jointCount; i++) {
7474
b2DestroyJoint(joints[i]);
7575
}
76+
const auto &sensorItems = mSensors.keys();
77+
for (auto &&sensor: sensorItems) {
78+
removeSensor(sensor);
79+
}
7680
qDeleteAll(mWheels);
7781
qDeleteAll(mSensors);
7882
b2DestroyBody(mBodyId);

0 commit comments

Comments
 (0)