diff --git a/src/modules/sbstudio/plugin/model/safety_check.py b/src/modules/sbstudio/plugin/model/safety_check.py index 59e93da..7675fc1 100644 --- a/src/modules/sbstudio/plugin/model/safety_check.py +++ b/src/modules/sbstudio/plugin/model/safety_check.py @@ -314,10 +314,13 @@ def should_show_proximity_warning(self) -> bool: """Returns whether the proximity warning should be drawn in the 3D view _right now_, given the current values of the properties. """ + # self.min_distance has to be extended a bit (by about 1cm) because of + # numerical inaccuracies that yield false warnings during takeoff when + # the grid spacing is equal to the safety distance return ( self.proximity_warning_enabled and self.min_distance_is_valid - and self.min_distance < self.proximity_warning_threshold + and self.min_distance + 1e-2 < self.proximity_warning_threshold ) @property diff --git a/src/modules/sbstudio/plugin/tasks/safety_check.py b/src/modules/sbstudio/plugin/tasks/safety_check.py index a68a635..c0e695e 100644 --- a/src/modules/sbstudio/plugin/tasks/safety_check.py +++ b/src/modules/sbstudio/plugin/tasks/safety_check.py @@ -208,7 +208,7 @@ def run_safety_check(scene: Scene, depsgraph) -> None: [ pos for name, vel in velocity_snapshot.items() - if (vel[0] != 0 or vel[1] != 0) + if hypot(vel[0], vel[1]) > 1e-2 and (pos := snapshot.get(name, _ZERO))[2] < min_altitude ] if min_altitude is not None and min_altitude_found < min_altitude