Godot: SkeletonIK is not working properly in 3.2

Created on 16 Mar 2020  Â·  12Comments  Â·  Source: godotengine/godot

SceletonIK is useless, and cannot work in the existing implementation, since it receives the result of the previous count on the input. Because of this, small errors accumulate in the calculation of bone transformation, because of which the “bones break” and this problem cannot be solved. It is also impossible to smoothly turn on and off IK.

All problems come from ONE CRITICAL ERROR, namely the incorrect definition of SceletonIK. For correct operation, inverse kinematics must be calculated after the animation and accept the result of the animation as input (preferably, a value for smooth on / off). SceletonIK cannot be inherited from Node, because it is very dependent on the animation, and only works correctly in conjunction with the animation. It’s best to inherit it from AnimationNode and use it in AnimationTreePlayer. This approach will help get rid of all existing problems with SceletonIK and add more flexibility to management (this approach is used in commercial engines for the above reasons).

Example for reproducing the error:
BUG

Optional: the calculations in SceletonIK is very difficult and useful only if you need to calculate more than two bones (I don’t take into account the final bone, it copies the transformation of the target node). To calculate two and one bone, you need a simpler algorithm, because all the calculations can be made accurate even in one pass. More often, counting of two and one bones is required, for example, for the hands, feet and head of characters.

Translated using google translator.

Godot version: 3.2

OS: Windows 10

bug confirmed regression core

Most helpful comment

Thank you for making this change! I no longer see this issue on the Godot master branch.

All 12 comments

Can you reproduce this with the 3D IK demo?

Can you reproduce this with the 3D IK demo?

This is one of the first projects that I installed and tried to run. But, a bug met me. A function was used in this project (I don’t remember the name now), which is not supported in version 3.2. After the correction, the error disappeared, but IK did not appear in any way.

Yes, I'm a noob in GDScript, so I left this venture. It’s easier for me to understand the engine code, which I’m doing now.

Translated using google translator.

A function was used in this project (I don’t remember the name now), which is not supported in version 3.2.

You need to use the latest version from the master branch for it to work with 3.2. The version on the asset library and the releases page does not work with Godot 3.2 since it is still using the Godot 3.1 IK system. You can either download a ZIP file or clone with Git:

git clone https://github.com/godotengine/godot-demo-projects.git

The version on the asset library and the releases page does not work with Godot 3.2 since it is still using the Godot 3.1 IK system.

This is bad, ordinary users will not mess with GitHub and search for working sources.

Thanks for the help, I did not know that the resource was not updated in the library. But I already set a goal to update the functionality in AnimationNodePlayer.

I am new to Godot and have plans like Napoleon, but if everything works out it will be useful and cool. And may the Force be with me.

UPD: Hard work has been done in IK Systems, but in C ++ it is much easier to do, and it will work faster.

I've also had a similar issue with SkeletonIK. I've attempted to minimally reproduce it in the attached project.
ik_issue.zip

To reproduce:

  • Open scene.tscn
  • In SkeletonIK press Play IK
  • In editor, quickly move ik_target back and forth
  • See the mesh separate from the armature

image

You can see that the octahedron for the armature isn't rendered correctly.
image

I've also recorded a video of this issue (in a zip file to make github happy).
ik_issue_video.zip

I've seen this issue for other meshes (in particular, some mixamo characters). Not all meshes that I've tried have this issue. As a random example I tried, the "Baqir" rig from animation sherpa did not have this issue. I also don't see this issue when using looking at the ik demo from the master branch of godot-demo-projects.

I was also able to reproduce this issue in Godot 3.1.1 (but it required more vigorously moving the IK target). This issue is also present in-game while playing animations, not just in editor.

Thanks for all your work on Godot! Please let me know if there's something I can do to help.

Godot Version: 3.2.1
OS: Ubuntu 18.04

Have you tried it in 3.1? I believe this broke (or at least became worse) in 3.2 with the removal of set_bone_global_pose(): https://github.com/godotengine/godot/issues/32637

I have a spiderbot using IK in 3.1 here: https://twitter.com/FistForgotten/status/1231226109892710400?s=20
And here's what it looks like in 3.2: https://clips.twitch.tv/LitigiousBrainyLemurMVGame

I think this might have been an oversight. I'm currently working around this by building my own custom 3.2 branch with set_bone_global_pose() added back in.

I was able to see this in Godot 3.1.1, but it required moving the IK target around in a way that wouldn't be reflective of normal gameplay (not perfect, but I'd live with it). It's much more of an issue in Godot 3.2.

Thanks for sharing your patch (in #32637)! I'll try it out.

Yeah, the IK behavior with animated skeletons in 3.2 is completely broken. The IK completely ignores the animation pose and even detaches the IK root bone from the parent. I've found that resetting the pose override each frame is a feasible workaround though.
For reference, here's a vid showcasing the IK behavior in 3.1.2, here's one in 3.2, which also shows the override resetting workaround, and here's the test project.

I'm guessing this line is the culprit. The persistent parameter should be false so that the IK can work off the animation provided global pose each frame. I don't have a toolchain set up right now to build Godot, so I can't check if that's the right fix right now, though.

Back when I was first tinkering with 3.2, I tried setting the persistent parameter to false, and it seemed to just not work at all. This was with my procedural hair, though, not the IK.

Edit: By not work at all, I mean the override appeared to not work and it simply used the animation instead.

I'm going to test this so to see where the problem is, however the SkeletonIK is already executed after the animation and this should guarantee that it never starts from the last IK result.

I let you know more.

Can you please check this issue with: https://github.com/godotengine/godot/pull/37272 ?

Thank you for making this change! I no longer see this issue on the Godot master branch.

Was this page helpful?
0 / 5 - 0 ratings