jv_btf

Hello I think I found what i suppose is a bug?! I did solve it already, but I will post it anyways.

So in the case of my game, I need to spawn one of a number of SkeletonAnimation Prefabs. Each of them will have player triggered animations with a SkeletonUtility set to "Follow all Bones". They are also using IK.

This should work right? But here's the catch:
Disclaimer: I didn't pour over your code to check my assumptions. this is just how i understand the problem occurs!

As far as I understand, you call HandleRendererReset in the skeleton utility to match up all of the SkeletonUtilityBones with the SkeletonAnimation. You do so after the SkeletonAnimation was initialized in Awake. Thats all well, if I set the initial Animation in the prefabs settings beforehand, but it doesn't work if I set the initial Animation during "Start" on another script (which I have to do, because the SkeletonAnimation won't be available until Start!
When I do, the SkeletonAnimation snaps into the startposition for its animation, but the SkeletonUtilityBones don't follow, because they are initialized with the initial Animation "None". Subsequently, parts of the skeleton will be kind of "stuck" in their starting rotations/positions, and will not follow the animation at all.

So what did i do to fix it? Well i made HandleRendererReset public and called it from my script, when i was done initializing the animations in Start(its multiple layers, so i can't set it beforehand). It would probably be better to call it from within SkeletonUtility though (possibly on the first Update frame, or at the end of the Start frame through a coroutine)
This works for me, and I hope it can help others as well.

In this GIF you can see first, the broken animation, and then the fixed one (i accidently made it into a single gif)


But I would love to see it fixed properly, as it seems like such a standard thing, to set initial animations through code during start.
jv_btf
  • Сообщения: 1

Harald

jv_btf писал(а):When I do, the SkeletonAnimation snaps into the startposition for its animation, but the SkeletonUtilityBones don't follow, because they are initialized with the initial Animation "None". Subsequently, parts of the skeleton will be kind of "stuck" in their starting rotations/positions, and will not follow the animation at all.
This is unexpected, the bones should not be stuck just because no animation is set at the beginning. Could you perhaps send us a minimal reproduction Unity project as a zip package, to contact@esotericsoftware.com? Then we can have a look at why the bones don't follow along afterwards.
Аватара пользователя
Harald

Harri
  • Сообщения: 1976


Вернуться в Unity