Make sure IK target is inside tree before using its transform

(cherry picked from commit 88e3ba83f0)
This commit is contained in:
Haoyu Qiu 2021-09-14 17:46:39 +08:00 committed by Rémi Verschelde
parent e46d54ebec
commit 018f28bead
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -549,7 +549,7 @@ Transform SkeletonIK::_get_target_transform() {
target_node_override = Object::cast_to<Spatial>(get_node(target_node_path_override)); target_node_override = Object::cast_to<Spatial>(get_node(target_node_path_override));
} }
if (target_node_override) { if (target_node_override && target_node_override->is_inside_tree()) {
return target_node_override->get_global_transform(); return target_node_override->get_global_transform();
} else { } else {
return target; return target;