Im using the 4.1 Version.

I want to reverse my animation. This does work. Hower, the animation will not reverse it smoothly, it "jumps" to a diffrent start... In this Gif you can see it, at every "jump" i just reversed the animation.

Is this how it should work?

Here is an Example Project (I modified the Nr.4 example). "Space" will change the direction.
Drive

Related Discussions
...

What code are you using to set the animation? So I don't have to dig through all your project files.

    Nate
    Hi, yes sorry:
    im setting it in the modified "SpineboyBeginnerView"
    173: skeletonAnimation.AnimationState.GetCurrent(0).Reverse = bool
    and this is called while pressing the spacebar.
    The Scene is the nr. 4 of the expamles.
    Here a reupload

    Thanks. I get it now, you are toggling TrackEntry reverse multiple times. Yes, I think this is how it is expected to work. When reversed the track time is flipped over, instead of 0 to animation duration it's animation duration to 0. Eg if you are at 25% of the animation duration, when reversed you'll be at 75%. That is very likely a different pose, so the skeleton jumps to the new pose.

    The reverse setting is not typically changed during playback. To have more control you could use the timeline API. That allows you to control the animation time yourself, you can adjust it forward or backward as needed.

    6 jours plus tard

    Thanks! Yes it is as you describe it. To be honest, it would be more intuitive if the pose would match the prev pose. But i can work with that.

    2 ans plus tard

    Hi, sorry for reopening old thread, but it would be great to mention this behavior in docs: https://en.esotericsoftware.com/spine-api-reference#TrackEntry-reverse

    Is it OK, to calculate and correct TrackTime in Update like that?

    if (wheelsTrackEntry.Reverse != lastVelocity.x < 0)
    {
            wheelsTrackEntry.Reverse = lastVelocity.x < 0;
    	wheelsTrackEntry.TrackTime = wheelsTrackEntry.Animation.Duration * (1f - wheelsTrackEntry.AnimationTime / wheelsTrackEntry.Animation.Duration);
    }
    • Nate a répondu à ça.

      abuki I've not tried that and reverse is not typically changed during playback, but it could be OK. My concern is some of the variables not exposed in TrackEntry like trackLast and nextTrackLast may become invalid. animationLast is exposed and may need to be adjusted, if you use timelines that use lastTime (currently event and physics reset timelines).

      Note your code resets the trackTime, regardless of your current playback. That effectively starts the animation over from the beginning (end if reversed). You could instead use setAnimation with no mix duration to start a the animation with reverse set as you need it from the start of playback.