AnimInstance::Montage_Play in C++ with -1 Play Rate Does Not Reverse the Animation

Dear Friends At Epic,

If I set the play rate to -1 in the editor, the montage plays in reverse,

if I use play montage based on the anim instance in the code,

whenever the play rate is -, the skeleton just freezes.

So my question is:

How can I play a montage in reverse from the c++?

Here’s the function I am using, based off of a shootergame example

void AVictoryPlayerCharacterBase::OnRep_PlayMontage()
{
	//modified from shootergameCharacter.cpp
	if (RepAnim && Mesh && Mesh->AnimScriptInstance)
	{
		Mesh->AnimScriptInstance->Montage_Play(RepAnim, CurMontagePlayRate);
	}
}

Here’s the AnimInstance.h Code:

/** Plays an animation montage. Returns the length of the animation montage in seconds. Returns 0.f if failed to play. */
UFUNCTION(BlueprintCallable, Category="Animation", meta=(InPlayRate="1.0"))
float Montage_Play(UAnimMontage* MontageToPlay, float InPlayRate);

#Rep

Try to use the above Montage_Play from C++ with a negative playrate and see if skeleton freezes or if it plays animation in reverse as it does in editor

#Work Around

Currently I must make a copy of the montage and set the playrate to be negative

#Thanks!

:slight_smile:

Rama

#More complicated

Actually even in the editor the skeleton freezes after I set the playrate to negative and then switch to a different anim and then back to the reversed montage.

So

#Rep

make a montage

set it to -1 playrate

while still in persona, click on a diffferent anim or montage and then back to the reversed montage.

in my case skeleton freezes

I’ve had a lot of freezing-skeleton issues in beta6 though so if you cannot rep this I can upload my project.

Enjoy your vacation!

Rama

Hi Rama,

Thank you for the information. I have reproduced and reported the issue.

Cheers

woohoo!

Thanks Stephen!

:slight_smile:

Rama