-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BoneAttachments do not take into account IK #48188
Comments
If possible, can you share a minimum reproduction project showing the issue? I have tested BoneAttachment3D nodes (Godot 4.0 - though SkeletonIK code should be the same) and they have been in sync for me. I will test in Godot 3.3 though, as perhaps the issue is just 3.3 specific. If the issue is that the first/root bone in the IK chain has twist rotation out of alignment, #48166 may fix the issue if the skeleton you are using has a -Z bone forward direction. |
I just tested an animated skeleton in Godot 3.3, and BoneAttachment nodes are correctly positioned and in sync for me. |
Can't reproduce this issue with my own test skeletons. Bone attachment uses the skeleton bone global pose on each update for its own position. The bone global pose is automatically updated by the SkeletonIK with the One possible explanation for this issue could be that something else (script or other node) is resetting or removing the |
Thanks for the feedback. Something must be off in my particular setup that's triggering this issue then. I couldn't "not reproduce this" on any of my attempts. I'll upload a reproduction project later today 😅
This looked promising. Indeed, my SkeletonIK node was after the BoneAttachment node in the scene tree. However, I switched their order, and even tried playing with their process priority and I still can't get the right behaviour. |
I found the issue. It's not a bug in Godot, but rather an incompatibility with the way I set up my skeletons. There's an extra bone on the character's hand to tweak held item locations. However, this bone is not parented to hierarchy, but rather using a constraint in Blender. Bone constraints don't export to Godot, so the parenting was lost (or rather, baked into the animations). This is why it appeared as if IK was being ignored: The IK solver was moving a bone and I was expecting the child to follow, but the child wasn't actually a child. Again, this has nothing to do with Godot per se, so I'll just close the issue. Thank you very much for your suggestions and help! 😄 |
Godot version:
3.3.stable
OS/device including version:
GNU/Linux
Issue description:
BoneAttachments do not play well with IK. If IK updates bones, it does so by setting the
global_pose_override
. However, bone attachments do not look at this value and instead keep using the originalglobal_pose
.This is an issue for example when games want to have an arm controlled by IK, and at the same time have an item attached to the end of that arm.
EDIT: I initially thought the issue was here. But after looking a bit more into the code, it seems the value of global_pos is mutated, and set to the value of global_pos_override, so I don't understand where the issue is.
I've had a quick line at the source, and this line is the culprit:godot/scene/3d/skeleton.cpp
Line 315 in dc98144
Here, instead ofb.pose_global
, it should be interpolating withb.global_pose_override
when that's set. Ideally, it should follow the exact same logic used here for the interpolation:godot/scene/3d/skeleton.cpp
Line 246 in dc98144
Steps to reproduce:
BoneAttachment
and make it point to one of the bones. Add a child cube to the attachment object.SkeletonIK
so that the attached bone will move.Here, the object should be moving together with the bones at their current position (affected by IK), but instead it's moving to the old bone position (as if it was unaffected by IK).
Discussion
A fix for this looks easy enough and I will attempt it myself if nobody else is interested in working on it. But I'd like to ask first whether you consider this an acceptable contribution before I take the time to submit a PR.
The text was updated successfully, but these errors were encountered: