diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-21 11:42:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 11:42:14 +0200 |
commit | 351d378b03e244e91c39ab90d564989cb3c933ca (patch) | |
tree | ec91102408543a1f5f60a80509ba6a5efe30b49c /scene | |
parent | 194b72821d3bd9af8d1ec41ff067da5f03d2f64c (diff) | |
parent | d5847f1cb4a86408d29a96d7882618b1931dd9b0 (diff) |
Merge pull request #54032 from nekomatata/fix-collision-mouse-exit-error
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/viewport.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 0e62e6e30a..3280190250 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2192,7 +2192,10 @@ void Viewport::_drop_physics_mouseover(bool p_paused_only) { if (physics_object_over.is_valid()) { CollisionObject3D *co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_over)); if (co) { - if (!(p_paused_only && co->can_process())) { + if (!co->is_inside_tree()) { + physics_object_over = ObjectID(); + physics_object_capture = ObjectID(); + } else if (!(p_paused_only && co->can_process())) { co->_mouse_exit(); physics_object_over = ObjectID(); physics_object_capture = ObjectID(); @@ -2213,7 +2216,7 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus Object *o = ObjectDB::get_instance(E->key()); if (o) { CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o); - if (co) { + if (co && co->is_inside_tree()) { if (p_clean_all_frames && p_paused_only && co->can_process()) { continue; } @@ -2239,7 +2242,7 @@ void Viewport::_cleanup_mouseover_colliders(bool p_clean_all_frames, bool p_paus Object *o = ObjectDB::get_instance(E->key().first); if (o) { CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o); - if (co) { + if (co && co->is_inside_tree()) { if (p_clean_all_frames && p_paused_only && co->can_process()) { continue; } |