• Runtimes
  • Modify rotation in different tracks

Hello everyone!

I have this setup where I have an animation rotating some bones as an "idle" animation, but I want to add a "shake" animation on track 1 (idle is obviously on 0).
This shake animation rotates the same bones in a different way, and what I want to achieve is to "add" the rotation. Is it possible?

When I preview the animation in the preview window in spine everything works just fine, is in Unity where the problem occurs.

If you need more specific information just let me know,

Thank you for your help!

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

    Yimec When I preview the animation in the preview window in spine everything works just fine

    @Yimec How did you preview the animation on the second track in the Spine Editor? Did you set the animation on the second track to Additive via this button:
    https://esotericsoftware.com/spine-preview#Additive
    Or do you want to just play the animation normally on the second track, overriding keys on lower tracks?

    If you want to apply animation additively, you need to set the TrackEntry MixBlend mode to MixBlend.Add.
    trackEntry.MixBlend = Spine.MixBlend.Add

    Yimec is in Unity where the problem occurs.

    What is "the problem", what kind of problem does occur? Please always describe what result you expect to see and what you see instead. Otherwise we have to guess.

    If you see rotations adding up with additive animation every frame and rotating more and more, you have not keyed the same property (e.g. the same bone's rotation value) on the base track (the idle animation on track 0). That then leaves the previous frame value and adds to that, in an ever increasing way.

    If it previews fine in the Spine Editor, it might be due to the skeleton being set to the setup pose before applying the preview animations, which is not what you typically do every frame in Unity.

    Hello @Harald, thanks for your reply.

    I set the preview animation as follows:
    (Sorry, it is in spanish)

    The layer 0 is Idle, layer 1 is Shake.

    The desired result is more visible with another animation called "Fall" instead of Idle.

    Here is the fall animation played alone on track 0:

    And this is when "shake" is on track 1 as well:

    However, setting these animations the same way in unity does not give the same result, it only plays the track 0 animation, (idle or fall, it doesn't matter). The expected result is what we are getting in the spine animation preview.

    Both tracks are keying the rotation of the same bones.

    I will try the MixBlend.Add mode in the meanwhile and come back if I get any result.

    Thank you again, I hope this explanation helps you helping me!

    @Yimec Thanks for the additional info! Judging from the Spine Editor preview settings, you are not using MixBlend Additive on the second track (the shake track), so you don't need to set it on the Unity side either.

    Could you please share the code you use to set the animation in Unity?

    @Harald
    The code is provided by the programmer, so I can't justify the steps, he sent me this abstract:

    track = spineAnimationState.SetAnimation(0, idle, true);
    var trackShaq = spineAnimationState.SetAnimation(1, tembleque, true);
    trackShaq.MixBlend = MixBlend.Add;

    He says this is the test where he stablished the blend mode to Add as you suggested in the previous message. No change.

    @Yimec Thanks for sending the code. I can see nothing obviously wrong with the above code. As mentioned before, trackShaq.MixBlend = MixBlend.Add; should not be set if you also don't set it to additive in the Spine Editor Preview.

    Could you perhaps send us a minimal Unity project that still shows your issue? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum URL so that we know the context. Then we can have a look at what's going wrong.

    Ok! I will setup this project if I can and sent it as soon as it is possible.

    Thank you for your help!