How do i play an animation montage in reverse in c++?

Hello i’m trying to play an animation montage but played in reverse, i tried using:

MyCharacter->PlayAnimMontage(MyAnimMontage, -1.0f);

But the animation freezes. I noticed on Persona that if i set Rate Scale to -1.0 he reverses the animation, but the InPlayRate parameter in C++ doesn’t seem to have the same behaviour. Thank you

this is a bug I encountered in the Beta, it looks like it still has not been fixed, Epic please help!

:slight_smile:

Thnks , a possible workaround for this is creating a new AnimMontage with Rate Scale -1.0f, but that is not very practical :frowning:

Hi xlar8or,

We are aware of this issue with anim montages. It is currently on our list of issues to correct. Unfortunately I do not have any way of knowing when we will have this issue fixed.

Thanks for the support, i will be waiting for the fix :slight_smile:

Hows the issue going? I’m encountering the same issue (although not using Pawn but regular AnimInstance montage functions) and regardless of how I try to set it up (without blend / setting the position to the length of anim right inside Montage_Play func, before Play() is called) it just doesn’t work.

			NewInstance->Initialize(MontageToPlay);
			if (InPlayRate < 0.0f)
				NewInstance->SetPosition(MontageToPlay->SequenceLength);
			NewInstance->Play(InPlayRate);

Hi vipeout,

What version of the Engine are you using currently? We had a ticket in for this issue that was marked as fixed in 4.12. If you are using 4.12 or later, would you be able to provide more details about how you are setting this up, or perhaps a small sample project that shows the behavior?

4.13.1 I’m having a skeletalmesh component inside a class derived from AActor. When I’m creating a simple montage based on anim sequence (right click → create → Montage) play forward goes ok, but backwards doesn’t.

At first it just threw OnMontageFinished in the next tick (when the anim thread done it’s job) and after seting the position in the way I described above it does “finish” the animation after proper time, but nothing happens to the skeletal mesh in question. I’d like the animation to jump to the end (due to the set pos) and then go reverse from there.

What is happening is, well, nothing. I’ll try making a sample project for you, but I haven’t really done a custom C++ sample (only BP ones) before and not really sure how would I go about it. Theoretically Montage_Play is callable from BP so i’ll start the sample with that, however using blueprint for the final solution won’t work for me.

Unfortunately, it’s impossible for me to provide you with the sample project, because there are no skeletal mesh and animation assets in the starter content, and the ones I’m working on cannot be shared. All I can give you are the repro steps:

  1. Place skeletal mesh on level
  2. Create an animation for it and create a basic montage based on it, that just plays the anim, nothing more (with playrate 1.0, the default)
  3. Create anim BP for it
  4. Do in the blueprint something like this:

And the anim is not played from backwards. Stops in the next gamethread tick that it starts from. With my change in *.cpp as shown above it still doesn’t work, it’s simply broken differently.

Hi vipeout,

Thank you for the additional clarification, and I apologize for the delay in getting back to you. With the information that you provided I was able to see the issue that you described. After doing some additional testing and research, it looks like what was happening here was that the start position for the Montage Play node was internally being set to 0. I was able to find out that this has been addressed for 4.14 by exposing the start position to allow you to start playing the montage at any point (it still defaults to 0). I ran some tests in 4.14 Preview 3 using the setup that you showed and when I set the start position to the end of the Montage, the animation would play correctly in reverse. If you have a to try 4.14 Preview 3, does Montage_Play() work for you there?

Works fine.

I’m glad it’s finally fixed :slight_smile: