summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-02-08 10:50:08 +0100
committerGitHub <noreply@github.com>2022-02-08 10:50:08 +0100
commit7e308d5120f61bcb70eb0afdbac35511484324d8 (patch)
tree82df07e48bacad02eb90cc3a2b1f2cc081e80901
parent6b13056409dba9c9ac1bccce23fb9320d7c48725 (diff)
parentbbcd9c5b9781fdbebd2e03a6bf054d387d3df24c (diff)
Merge pull request #57791 from timothyqiu/raycast-clear-except
-rw-r--r--scene/2d/ray_cast_2d.cpp7
-rw-r--r--scene/3d/ray_cast_3d.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index 9521667854..51b3e676f9 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -279,6 +279,13 @@ void RayCast2D::remove_exception(const CollisionObject2D *p_node) {
void RayCast2D::clear_exceptions() {
exclude.clear();
+
+ if (exclude_parent_body && is_inside_tree()) {
+ CollisionObject2D *parent = Object::cast_to<CollisionObject2D>(get_parent());
+ if (parent) {
+ exclude.insert(parent->get_rid());
+ }
+ }
}
void RayCast2D::set_collide_with_areas(bool p_enabled) {
diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp
index b71c54dcf9..b251aa38ba 100644
--- a/scene/3d/ray_cast_3d.cpp
+++ b/scene/3d/ray_cast_3d.cpp
@@ -259,6 +259,13 @@ void RayCast3D::remove_exception(const CollisionObject3D *p_node) {
void RayCast3D::clear_exceptions() {
exclude.clear();
+
+ if (exclude_parent_body && is_inside_tree()) {
+ CollisionObject3D *parent = Object::cast_to<CollisionObject3D>(get_parent());
+ if (parent) {
+ exclude.insert(parent->get_rid());
+ }
+ }
}
void RayCast3D::set_collide_with_areas(bool p_enabled) {