File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
plugins/robots/common/twoDModel/src/engine/model Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 2222
2323#include < kitBase/robotModel/robotParts/encoderSensor.h>
2424#include < kitBase/robotModel/robotParts/motor.h>
25+ #include < kitBase/robotModel/robotParts/rangeSensor.h>
2526
2627#include " twoDModel/engine/model/constants.h"
2728#include " twoDModel/engine/model/settings.h"
@@ -279,7 +280,13 @@ void RobotModel::setPhysicalEngine(physics::PhysicsEngineBase &engine)
279280QRectF RobotModel::sensorRect (const PortInfo &port, const QPointF sensorPos) const
280281{
281282 if (!mSensorsConfiguration .type (port).isNull ()) {
283+ auto device = mSensorsConfiguration .type (port);
282284 const QSizeF size = mRobotModel .sensorImageRect (mSensorsConfiguration .type (port)).size ();
285+ // We don't need part with radiating waves from range sensor in bounding rect of sensor
286+ if (device.isA <robotParts::RangeSensor>()) {
287+ return QRectF (sensorPos.x () - size.width ()/2 , sensorPos.y () - size.height ()/2
288+ , size.width ()/2 , size.height ());
289+ }
283290 return QRectF (sensorPos - QPointF (size.width () / 2 , size.height () / 2 ), size);
284291 }
285292
You can’t perform that action at this time.
0 commit comments