if (AnimInstance&&Cast<ACharacter>(Result.GetActor()))
{
UAnimMontage* CurrentMontage = AnimInstance->GetCurrentActiveMontage();
CurrentMontage->bEnableAutoBlendOut = false;
AnimInstance->Montage_SetPlayRate(CurrentMontage, 0.f);
FTimerHandle TimerHandle;
TWeakObjectPtr<USkeletalMeshComponent> WeakMeshComp = GetMesh();
WeakMeshComp->GetWorld()->GetTimerManager().SetTimer(
TimerHandle,
[WeakMeshComp,&TimerHandle]()
{
if (WeakMeshComp.IsValid())
{
if (UAnimInstance* AnimInstance = WeakMeshComp->GetAnimInstance())
{
if (UAnimMontage* CurrentMontage = AnimInstance->GetCurrentActiveMontage())
{
AnimInstance->Montage_SetPlayRate(CurrentMontage, 1.f);
CurrentMontage->bEnableAutoBlendOut = true;
}
}
}
WeakMeshComp->GetWorld()->GetTimerManager().ClearTimer(TimerHandle);
},
0.15f,
false
);
}
this is the code in the character class, I want the character stop the montage 0.15s and keep the pose, but in the game, the montage doesn’t stop at this frame, it continues moving a few frames(about 3-5) and finally stop, why? are there any way to solve the problem,