• RuntimesUnity
  • Mesh breaks when blending

Hello Spine Team!

Unity 2022.3.29f1
Spine Editor 4.2.38 Professional
Spine-Unity Runtime: spine-unity 4.2.94

Video example of the issue:

Could you help me understand what's going wrong here? Trying to nicely blend between 2 run animations and the mesh breaks when I change an Alpha parameter of one of 2 entry tracks. Default mix transitions work correctly when changing one animation to another in the same track.

Test code example:

public class SpineBlendTest : MonoBehaviour
{
    private SkeletonAnimation skeletonAnimation;

    [SerializeField]
    private float blendMix;
    
    private TrackEntry runTrackEntry;
    private TrackEntry gallupTrackEntry;

    private void Start()
    {
        skeletonAnimation = GetComponent<SkeletonAnimation>();
        
        runTrackEntry = skeletonAnimation.state.SetAnimation(0, "run", true);
        gallupTrackEntry = skeletonAnimation.state.SetAnimation(1, "gallup", true);
        gallupTrackEntry.MixBlend = MixBlend.Add;
    }

    void Update()
    {
        gallupTrackEntry.Alpha = blendMix;
    }
}

Thank you in advance.

Best Regards,
Igor

  • Misaki ответили на это сообщение.
    Related Discussions
    ...
    • Изменено

    Hello Igor,

    The issue you're experiencing with the mesh breaking when blending between two animations using the Alpha parameter on separate tracks could be related to how the animations are being mixed. When using MixBlend.Add, it's important to ensure that the animations on the lower track (in this case, the "run" animation) have all the necessary keys set, as the additive blending will rely on these keys.

    Here are a few things to check and try:

    1. Ensure Complete Keying: Make sure that the "run" animation has all the necessary properties keyed that the "gallup" animation will modify. If the "run" animation doesn't have these keys, the additive blend might not work as expected.

    2. Setup Pose: The Spine Editor's preview might call setToSetupPose each frame, which can hide issues with additive tracks. Ensure that your runtime setup doesn't rely on this behavior unless explicitly handled.

    3. Animation Cleanup: When exporting your skeleton, ensure that "Animation cleanup" is disabled if you're using additive tracks. This prevents the removal of keys that are identical to the setup pose, which are necessary for proper blending.

    4. MixBlend Mode: Consider whether MixBlend.Add is the correct mode for your use case. If the animations are not intended to be additive, you might want to use MixBlend.Replace instead.

    5. AlphaAttachmentThreshold: If attachments are involved, you might need to adjust the AlphaAttachmentThreshold to ensure attachments are visible at the correct times.

    By ensuring that the base animation has all necessary keys and that the blending mode is correctly set, you should be able to achieve a smoother transition between your animations.

    Best Regards,
    Spinebot

    IGR Spinebot is correct, you need to make sure that the run animation has all the keys of the elements to be modified within the gallup animation. You may find Nate's answer in the following thread on the MixBlend.Add specification helpful:
    https://esotericsoftware.com/forum/d/18360-animation-mixingblending/3

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

      Misaki thank you, setting all keys helped!