• Unity
  • Animation Speed Changes When Transitioning

Good Evening,

For some reason, when my character changes from one animation to another, the speed drastically increases briefly and then returns to the normal speed.

I am using SetAnimation() and using the same track to replace the animation.

For example:
I will play the Idle animation like this.

SpineSkeleton.state.SetAnimation(10, Idle, true);

& then when my player moves I will play the walk animation like this:

SpineSkeleton.state.SetAnimation(10, Idle, true);

What could be causing this? :think:

Edit: I captured a recording of this occurring to demonstrate what's happening. When the character transitions to walking, it's almost like the first cycle after has a burst of speed, and then it adjusts to the correct speed :scared:

PayasoPrince escribió

& then when my player moves I will play the walk animation like this:
SpineSkeleton.state.SetAnimation(10, Idle, true);

A side note: both your lines of code are identical, setting the idle animation. I assume you've pasted the wrong line there.

It's hard to say from a video alone without having the skeleton assets available. Perhaps this issue is due to the first frames in your walk animation being in the extreme pose and mixing (angle interpolation) from your idle to your walk animation result in an unfortunate combination due to mix duration.

While we don't know how you set the walk animation, does the problem change when modifying mix duration?

Harald escribió
PayasoPrince escribió

& then when my player moves I will play the walk animation like this:
SpineSkeleton.state.SetAnimation(10, Idle, true);

A side note: both your lines of code are identical, setting the idle animation. I assume you've pasted the wrong line there.

It's hard to say from a video alone without having the skeleton assets available. Perhaps this issue is due to the first frames in your walk animation being in the extreme pose and mixing (angle interpolation) from your idle to your walk animation result in an unfortunate combination due to mix duration.

While we don't know how you set the walk animation, does the problem change when modifying mix duration?

Thank you for the reply!

Oh, whoops! Yes, that was a typo and should be walk. I will adjust the first post now. :wounded:
Edit: Is what I would say! For some reason I don't have the edit option.
It should read:

& then when my player moves I will play the walk animation like this:

SpineSkeleton.state.SetAnimation(10, Walk, true);

The problem exists with/without editing the mix duration. :think:


To clarify, even if I set the mix duration to 0, this issue occurs. So I don't think that is the problem.

Is there an issue with replacing the Idle animation on track 10 with the walk animation also on track 10?

PayasoPrince escribió

To clarify, even if I set the mix duration to 0, this issue occurs. So I don't think that is the problem.

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

PayasoPrince escribió

Is there an issue with replacing the Idle animation on track 10 with the walk animation also on track 10?

There is nothing wrong with that, quite the opposite: It is recommended to have animations of similar "responsibiliy" on the same track in order to mix in and out of animations in sync automatically.

I've isolated the issue.

When I I transition from Idle > Walking simply using:

SpineSkeleton.AnimationState.SetAnimation(10, Walk, true);

The walk animation plays perfectly and there is no issue.

However, when I implement the following, the issue occurs:

var trackEntry = SpineSkeleton.AnimationState.SetAnimation(10, Walk, false);
trackEntry.AnimationStart = 0.3f;
SpineSkeleton.AnimationState.AddAnimation(10, Walk, true, 0);

The above code was provided by Misaki in this thread:
animationStart Assistance

The reason it's being used is because I want the walking animation to start at a specific point, but on the next cycle I want it to play from the beginning/0. Is this not the proper way to accomplish this?

I think it is most likely a MixDuration issue as Harald first pointed out. Could you try to set the walk-to-walk Mix Duration to 0 in the Mix Settings of your SkeletonDataAsset?

Misaki escribió

I think it is most likely a MixDuration issue as Harald first pointed out. Could you try to set the walk-to-walk Mix Duration to 0 in the Mix Settings of your SkeletonDataAsset?

This exactly what it was! I set walk > walk to 0 and it fixed the issue. Thank you very much! 😃

I'm glad to hear the issue is solved! Thank you for getting back to us 🙂