summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2022-02-27 23:57:51 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2022-10-06 13:58:54 +0200
commit90b01d79af732b1906f13279f1cc928391d72557 (patch)
tree94cf588dd104eee4f488cdf9e9d80b29a620a246
parent61021c08f80856f8d99dfbe9fd3d338ef5f41999 (diff)
Fix execution of physics picking events
Fix that physics picking can happen after the mouse has left the viewport
-rw-r--r--scene/main/viewport.cpp5
1 files changed, 5 insertions, 0 deletions
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);