summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-04-29 17:29:51 +0200
committerGitHub <noreply@github.com>2020-04-29 17:29:51 +0200
commitb46e5c7b946c71ea4aa56ab067514124b5c306d8 (patch)
tree5c7adfc375e42b50a87bf026bed1a2ebd743981a /scene
parent39a0cdac5fa84bb9a49610acd7fc6c3b22de3979 (diff)
parente321d38c0ec6261a861100260689aa022237112e (diff)
Merge pull request #38203 from woollysammoth/multiple-ik-bug
Fixes SkeletonIK resetting other IK poses
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/skeleton_ik_3d.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index e8a9d5bf57..10bdd71d73 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -287,7 +287,15 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
return; // Skip solving
}
- p_task->skeleton->clear_bones_global_pose_override();
+ p_task->skeleton->set_bone_global_pose_override(p_task->chain.chain_root.bone, Transform(), 0.0, true);
+
+ if (p_task->chain.middle_chain_item) {
+ p_task->skeleton->set_bone_global_pose_override(p_task->chain.middle_chain_item->bone, Transform(), 0.0, true);
+ }
+
+ for (int i = 0; i < p_task->chain.tips.size(); i += 1) {
+ p_task->skeleton->set_bone_global_pose_override(p_task->chain.tips[i].chain_item->bone, Transform(), 0.0, true);
+ }
make_goal(p_task, p_task->skeleton->get_global_transform().affine_inverse().scaled(p_task->skeleton->get_global_transform().get_basis().get_scale()), blending_delta);