From 0454848f4d6fce50cc27b936209d0300092dd92d Mon Sep 17 00:00:00 2001 From: Tokage Date: Fri, 21 Aug 2020 13:56:04 +0900 Subject: [PATCH] fix unintentional object rotation by animation tree (cherry picked from commit ddac0e95dc72ffe9472495d6b46743829c4dbea9) --- scene/animation/animation_tree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index df82b2841a3..be11668154a 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -599,9 +599,9 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) { if (path.get_subname_count() == 1 && Object::cast_to(spatial)) { Skeleton *sk = Object::cast_to(spatial); + track_xform->skeleton = sk; int bone_idx = sk->find_bone(path.get_subname(0)); if (bone_idx != -1) { - track_xform->skeleton = sk; track_xform->bone_idx = bone_idx; } } @@ -1207,7 +1207,7 @@ void AnimationTree::_process_graph(float p_delta) { } else if (t->skeleton && t->bone_idx >= 0) { t->skeleton->set_bone_pose(t->bone_idx, xform); - } else { + } else if (!t->skeleton) { t->spatial->set_transform(xform); }