From 90b01d79af732b1906f13279f1cc928391d72557 Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Sun, 27 Feb 2022 23:57:51 +0100 Subject: Fix execution of physics picking events Fix that physics picking can happen after the mouse has left the viewport --- scene/main/viewport.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scene/main') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 234cebd821..d5371ae6a7 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -519,6 +519,11 @@ void Viewport::_process_picking() { if (to_screen_rect != Rect2i() && Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { return; } + if (!gui.mouse_in_viewport) { + // Clear picking events if mouse has left viewport. + physics_picking_events.clear(); + return; + } _drop_physics_mouseover(true); -- cgit v1.2.3