Merge pull request #65292 from AlmightyLaxz/prevent-shapecast3d-debug-without-debugcollisions

This commit is contained in:
Rémi Verschelde 2022-09-05 13:59:51 +02:00 committed by GitHub
commit 904d8bdb3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,7 +205,7 @@ bool ShapeCast3D::is_enabled() const {
void ShapeCast3D::set_target_position(const Vector3 &p_point) { void ShapeCast3D::set_target_position(const Vector3 &p_point) {
target_position = p_point; target_position = p_point;
if (is_inside_tree()) { if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) {
_update_debug_shape(); _update_debug_shape();
} }
update_gizmos(); update_gizmos();
@ -306,7 +306,7 @@ real_t ShapeCast3D::get_closest_collision_unsafe_fraction() const {
} }
void ShapeCast3D::resource_changed(Ref<Resource> p_res) { void ShapeCast3D::resource_changed(Ref<Resource> p_res) {
if (is_inside_tree()) { if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) {
_update_debug_shape(); _update_debug_shape();
} }
update_gizmos(); update_gizmos();
@ -327,7 +327,7 @@ void ShapeCast3D::set_shape(const Ref<Shape3D> &p_shape) {
shape_rid = shape->get_rid(); shape_rid = shape->get_rid();
} }
if (is_inside_tree()) { if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) {
_update_debug_shape(); _update_debug_shape();
} }