• RuntimesUnityBugs
  • Bone positions break inside Unity and mess up the character rig

Problem statement

Hey all,
We are having an issue where our character ‘breaks’ inside Unity - the rig and animations seem to be okay, and then our character’s bones get into wrong positions. That would result, for example, in the sword arm being ‘stuck’ in a weird place even though the character has performed the animation successfully prior, or shoulders being offset, or foot bones being ‘stuck’.

A list of the bone position problems we’re having:

  1. Sword/sword arm bone position breaking. This also occurs to some other parts of the character, like the hat. This usually happens after an animation is played and then the character transitions into idle animation. The bones get ‘stuck’ there. To remedy this we had to make a makeshift solution where we adjusted the animation within Spine so it works correctly in Unity.

sword attack ground up video side-by-side Unity/Spine - Google Drive

  1. Shoulders break seemingly because the bone responsible is not correctly flipped using scale. We double and triple checked all possible reasons to try to troubleshoot but couldn’t resolve it.

shoulder breaking video in Unity - Google Drive

  1. Foot bones ‘break’ when the character jumps down from a ledge, and from diagonal downward attack.

foot bones video 'breaking' - Google Drive

Specifics of the rig:

  • the character is assymetrical in design, meaning that we cannot just flip her horizontally when she needs to face the other way. She has a fencing cape on one shoulder, and armor on the other, and always holds her sword in her right hand.

  • to make it ‘flip’ properly we made two skins, left-facing and right-facing, which are used depending on the facing direction. Since the bone structure also changes, not just the image slots, we have 2 sets of arm bones for left/right facing directions. So the character has 4 arms, but only 2 are visible at one time. We initially thought this might be the culprit but after troubleshooting everything, it all flips and works correctly.

a video illustrating how the rig works - Google Drive

What we did:

  1. Checked that everything is keyframed correctly in Spine and that keyframes exist for everything and nothing gets overwritten incorrectly when blending animations

  2. Checked if it’s an animation track issue and tried different setups, even turning off tracks completely.

Runtime information

Tell us your Spine Runtimes version.

4.1.23

    Related Discussions
    ...

    HammundsCat We are having an issue where our character ‘breaks’ inside Unity - the rig and animations seem to be okay, and then our character’s bones get into wrong positions. That would result, for example, in the sword arm being ‘stuck’ in a weird place even though the character has performed the animation successfully prior, or shoulders being offset, or foot bones being ‘stuck’.

    Sorry to hear you're having troubles! Unfortunately it's hard to tell from videos and prose text alone. Could you please share code that you use to playback animations? What animations are played on which tracks, or does it use a single track? How do you enqueue or stop animations on tracks? Are you using SkeletonAnimation or SkeletonMecanim as skeleton component?

    Please note that the last pose of an animation is held on a track unless you add the empty animation (AnimationState.AddEmptyAnimation()) to mix out the animation.

    HammundsCat The bones get ‘stuck’ there. To remedy this we had to make a makeshift solution where we adjusted the animation within Spine so it works correctly in Unity.

    You should never need to create such workarounds, instead the root of the problem should be fixed.

    A side note: please be sure to export with Animation clean up disabled in the export settings.

    HammundsCat Shoulders break seemingly because the bone responsible is not correctly flipped using scale.

    How do you flip your skeleton? Do you scale a certain bone in the skeleton, or do you use SkeletonAnimation.ScaleX? Does the problem not occur if you flip the same bone in the Spine Editor? Please be sure to check whether Inherit Scale is properly setup, and whether your potential IK setup is setup in a way which reacts properly to flipping certain bones (which you can both check in the Spine Editor).