diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/shape_cast_3d.cpp | 20 | ||||
-rw-r--r-- | scene/3d/shape_cast_3d.h | 6 |
2 files changed, 10 insertions, 16 deletions
diff --git a/scene/3d/shape_cast_3d.cpp b/scene/3d/shape_cast_3d.cpp index 87361d6b38..d880e422f0 100644 --- a/scene/3d/shape_cast_3d.cpp +++ b/scene/3d/shape_cast_3d.cpp @@ -437,26 +437,18 @@ void ShapeCast3D::add_exception_rid(const RID &p_rid) { exclude.insert(p_rid); } -void ShapeCast3D::add_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); - if (!co) { - return; - } - add_exception_rid(co->get_rid()); +void ShapeCast3D::add_exception(const CollisionObject3D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D."); + add_exception_rid(p_node->get_rid()); } void ShapeCast3D::remove_exception_rid(const RID &p_rid) { exclude.erase(p_rid); } -void ShapeCast3D::remove_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); - if (!co) { - return; - } - remove_exception_rid(co->get_rid()); +void ShapeCast3D::remove_exception(const CollisionObject3D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D."); + remove_exception_rid(p_node->get_rid()); } void ShapeCast3D::clear_exceptions() { diff --git a/scene/3d/shape_cast_3d.h b/scene/3d/shape_cast_3d.h index 344f1d3b8a..98158d3c7c 100644 --- a/scene/3d/shape_cast_3d.h +++ b/scene/3d/shape_cast_3d.h @@ -34,6 +34,8 @@ #include "scene/3d/node_3d.h" #include "scene/resources/shape_3d.h" +class CollisionObject3D; + class ShapeCast3D : public Node3D { GDCLASS(ShapeCast3D, Node3D); @@ -133,9 +135,9 @@ public: bool is_colliding() const; void add_exception_rid(const RID &p_rid); - void add_exception(const Object *p_object); + void add_exception(const CollisionObject3D *p_node); void remove_exception_rid(const RID &p_rid); - void remove_exception(const Object *p_object); + void remove_exception(const CollisionObject3D *p_node); void clear_exceptions(); virtual PackedStringArray get_configuration_warnings() const override; |