• RuntimesUnityBugs
  • Setting an IK Constraint mix to 0 is not working as intended in Unity

Hi !
I have a Spine skeleton with 2 animations. The skeleton has an IK Constraint on its leg. In the first animation (idle), the Mix of this Constraint is 100, as I want the leg not to move.
In the second animation, I set on the first frame the Mix of this Constraint to 0, as I want the leg to move, this time.
In Spine Editor, it's working well. But once I export it as JSON and import it in Unity, I have a bug. If I play the Idle before the Push, the leg will not move during the Push, as if the Constraint Mix was still 100 (instead of 0).

It's very consistent when I play my game, but it's more random if I just check the animation in the Unity Inspector (sometimes the bug appears, sometimes no, sometime I need to reimport the Skeleton to trigger it.)
I have made a video to show the issue :

As I said in the end of the video, there is a weird workaround: If, instead of a Constraint Mix of 0, I set it to "0.1", for example, it will work as intended.
It's why for me, it's an issue similar to the one described here: https://esotericsoftware.com/forum/d/26897-exporting-animation-with-physics-constraints-keyframes-breaks-the-contraint, but probably in the Unity side.

For an easier repro, here is my Spine project and Unity export: https://www.studiochahut.com/dl/SpineDogBug.zip

Runtime information

Tell us your Spine Runtimes version.
4.2.42

  • Harald ответили на это сообщение.
    Related Discussions
    ...

    The issue you're experiencing with the IK Constraint mix in Unity seems to be related to a known problem where setting the mix value to 0 can cause unexpected behavior. This is similar to the issue reported in the forum discussion you referenced, where a mix value of 0 in the setup pose causes the constraint to stop working correctly, even if the mix value is changed during the animation. A workaround, as you discovered, is to set the mix value to a very small non-zero number, such as 0.1, which allows the constraint to function as expected. This issue has been acknowledged and a ticket has been created to address it: Issue #836.

    Gabriel_Wink Tell us your Spine Runtimes version.
    4.2.42

    That's your Spine Editor version.

    If not and you're still using spine-unity 4.2.42, please note that in the meantime we've arrived at version 4.2.106, so an update would be recommended.

    @Gabriel_Wink Please also check whether you've disabled Animation clean up during skeleton export. Otherwise keys identical to the setup pose will be removed, unless Layered is enabled at the animation.

    Hi Harald, thanks for your answer.
    Animation clean up was not disabled for this skeleton... I feel a little bit dumb to not have double checked that. It fixed the issue.
    Thanks a lot.

    • Harald ответили на это сообщение.
    • Harald оценил это.

      Gabriel_Wink Glad to hear you've figured it out, thanks for getting back to us.