Description

When sampling root motion backwards we can hit an infinite loop in ExtractRootMotion. This happens if the initial sample time + negative delta is off the end of the animation clip. In that case FAnimationRuntime::AdvanceTime() ends up clamping CurrentPosition so that it's the same as PreviousPosition meaning that our ActualDeltaMove is zero and we get stuck in the while loop.

Steps to Reproduce
  1. Call ExtractRootMotion passing a StartTime off the end of the anim clip and a negative delta that doesn't take us to a sample point during the duration of the clip.
    1. eg. ThirdPersonIdle -> StartTime=5.0, DeltaTime=-1.0, AllowLooping=true
    2. This can be done via the following blueprint lib method:
       void UAnimationBlueprintLibrary::ExtractRootMotionFromSequence(const UAnimSequence* AnimationSequence, float StartTime, float DeltaTime, bool bAllowLooping)
      {
      	if (AnimationSequence)
      	{
      		AnimationSequence->ExtractRootMotion(StartTime, DeltaTime, bAllowLooping);
      	}
      } 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-136750 in the post.

6
Login to Vote

Backlogged
CreatedDec 6, 2021
UpdatedJan 24, 2023