Division by zero in FAnimNode_StrideWarping::EvaluateSkeletalControl_AnyThread

When Actor’s CustomTimeDilation is 0.0 then FActorComponentTickFunction::ExecuteTickHelper() will call ExecuteTickFunc() with 0.0.

When StrideWarping is used the 0.0 then ends up in FAnimNode_StrideWarping::UpdateInternal() setting the CachedDeltaTime as 0.0.

Then in FAnimNode_StrideWarping::EvaluateSkeletalControl_AnyThread() there’s a division by zero on this line:

CachedRootMotionDeltaSpeed = CachedRootMotionDeltaTranslation.Size() / CachedDeltaTime;

Which can also cause CachedRootMotionDeltaSpeed to become NaN when CachedRootMotionDeltaTranslation.Size() is zero. Depending on the compiler and the settings for it this might or might not cause the the following check later on to fail:

check(!Foot.IKFootBoneTransform.ContainsNaN());

Let me know if more information is needed! I haven’t tried recreating this yet in an empty project but I think this should hopefully be fairly straightforward.

Steps to Reproduce
Set Actor’s CustomTimeDilation to 0.0 and use StrideWarping

Hi Markku,

Thank you for the report. I was able to repro this issue, although it did take some experimenting and digging into the engine source code. Notably, the problem of CachedRootMotionDeltaSpeed becoming NaN seems to occur only when the “Stride Warping” node is set to “Graph” mode (not “Manual”). What I found most interesting, though, was that the test (CachedRootMotionDeltaSpeed <= MinRootMotionSpeedThreshold) actually succeeds when the engine is compiled with /fp:fast instead of /fp:precise for the floating-point model used by the compiler (/fp:fast is the default for official releases distributed from the launcher). This luckily keeps ActualStrideScale from also becoming NaN, which also prevents the later check() you mentioned.

The problem does repro with /fp:precise, and in any case it seems quite dangerous to have CachedRootMotionDeltaTranslation and CachedDeltaTime both at zero when CustomTimeDilation is zero. Therefore, I filed an internal bug report so that the engine devs can take a closer look. Here’s the bug tracking number: UE-338254. You should be able to access the link once the devs mark it as public.

Let me know if you need anything further.

Best regards,

Vitor