Merge pull request #57791 from timothyqiu/raycast-clear-except

This commit is contained in:
Rémi Verschelde 2022-02-08 10:50:08 +01:00 committed by GitHub
commit 7e308d5120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -279,6 +279,13 @@ void RayCast2D::remove_exception(const CollisionObject2D *p_node) {
void RayCast2D::clear_exceptions() { void RayCast2D::clear_exceptions() {
exclude.clear(); 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) { void RayCast2D::set_collide_with_areas(bool p_enabled) {

View file

@ -259,6 +259,13 @@ void RayCast3D::remove_exception(const CollisionObject3D *p_node) {
void RayCast3D::clear_exceptions() { void RayCast3D::clear_exceptions() {
exclude.clear(); 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) { void RayCast3D::set_collide_with_areas(bool p_enabled) {