summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-03-19 08:38:27 +0100
committerGitHub <noreply@github.com>2021-03-19 08:38:27 +0100
commit67dc0679701602102637846a35f457447a6fc887 (patch)
treeeb881cd6583ded8bafe7c3fa991747ceb250fd49
parent47cf9985ebf2799d9718fa1a2ca96f2f70c6d212 (diff)
parent195eda244f5f259c45dc64818b1830ce323e4bf7 (diff)
Merge pull request #47151 from nekomatata/soft-body-attachment-error
Fix spamming errors when SoftBody pinned nodes have no attachment
-rw-r--r--scene/3d/soft_body_3d.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index 2d8f22ab37..b732f81e4e 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -768,7 +768,9 @@ void SoftBody3D::_reset_points_offsets() {
PinnedPoint *w = pinned_points.ptrw();
for (int i = pinned_points.size() - 1; 0 <= i; --i) {
if (!r[i].spatial_attachment) {
- w[i].spatial_attachment = Object::cast_to<Node3D>(get_node(r[i].spatial_attachment_path));
+ if (!r[i].spatial_attachment_path.is_empty() && has_node(r[i].spatial_attachment_path)) {
+ w[i].spatial_attachment = Object::cast_to<Node3D>(get_node(r[i].spatial_attachment_path));
+ }
}
if (!r[i].spatial_attachment) {