Problems with UE5's Distance Matching when tring to reuse Lyra's anim technique

I migrate Lyra AnimBP to my own project(just the animbp and animation assets , no cpp like lyra anim instance), and setup my own character. I find a weird thing happening with the character, sometimes one frame of the animation is completely off, for example my character is moving then I fastly switch between move left & move right, the pivot animation or the start animation have this one frame just jump out of nowhere, a very glitchy feeling.

In the video I just try to trigger the start when the previous one is almost finished, the play rate is weird, sometimes it can go over 100 that looks really off. I think it has something to do with the Advance Time By Distance Matching function in Update Start Anim on the ABP_ItemAnimLayersBase, but I am not sure. Also my character is very basic like in the thirdperson template, I just set it’s movement speed to 500 and use Controller Yaw Rotataion. Anyone has a clue?


I also print the parameter of the function Advance Time By Distance Matching it seems normal and consistent, I don’t know why sometimes this kind glitchy frame happen. And also there is no problem with the first time triggering any Start or Pivot State, If I don’t stop the movement and try to trigger it repeatly it will go wrong very easily. It dosen’t seem to have the problem in the Lyra Project, maybe I am missing something. Apart from this problem my migration seems to work just like Lyra.

~ slomo .2
~ anim debug
Tab to select character.

Record screen.

Review footage to see animation weights / transitions during the problem issue.

Not many other ways to go about it.

Also, if the curves below it are accurate, your Aim Offset could be getting in the way.
Just manually check anything else / look at what the most weighted animation is.

I think the cause is the sudden change of the distance curve value,

I can reproduce this problem in lyra starter project using thirdperson character with lyra’s animbp, still trying to figuring out the details.

That is a hard gap, but its also very brief.
How is the curve being applied? (And used)

Based on that, you could possibly lessen similar gaps by filtering the data.
Even a simple lerp between the value of the previous frame (stored after lerp) and the current value it should be could prevent sudden stutters…

The Curve is handled by Lyra’s AnimBP, I didn’t change anything. I guess I should just add some extra logic before the curve being passed to function like AdvanceTimeByDistanceMatching. I still don’t know why there is gap like this. Also thanks for answering my question.

The problem exists in Lyra Character too !

I think I get it.
Its basically stopping, the distance curve is telling it that the destination was reached or the input was removed.

Applying a lerp like i suggest would remove the issue when it deals with 1/2 frames max.

Whatever is generating the curve is at fault here. Why is it thinking that the motion is over?
Be it the c++ predictive code behind it or the animation curve value itself - one of them is incorrect…

I’m implementing Lyra’s animation system in my own project and found the same problem. It seems to happen more frequently if you pivot while already in a pivot animation, but I’ve had it occur pivoting during a cycle animation as well. It happens in all directions (fwd, bck, left, and right). I’ve been printing out a lot of the variables to see if one of the parameters (velocity, acceleration, etc.) is odd and I can’t spot anything. The dip is about 2 or 3 frames long (at ~ 60fps), its pretty noticeable at runtime.

It always seems to happen in the recovery phase of the animation (after the pivot itself), so I believe the issue is with the “Advance Time by Distance Matching” node. The displacement variable seemed fine, I could not spot any alarming changes in it at runtime. At this point I’m not really sure what to do in the editor to curtail this behavior.

@Zalc96 Did you happen to find a solution to this / file a bug report?

I think is the problem with the distance matching function too, but I don’t have the time to dive too deep into the c++ part of the engine code. I am still waiting for a solution, maybe in the next 5.2 engine update.

Distance Matching function doesn’t take current Distance curve value. It reads static curve from processed animation sequence from Sequence Evaluator node. So, this may happen if active asset in Sequence Evaluator was changed (or DistanceTraveled drop). Just my guess.

@Zalc96 I noticed in my project that this problem was due to sync marks. Try to disable “Sync Group” in Pivot states and look if this problem still happens.

P.S. It seems that Sync Group Role “Always Leader” is not working as intended.

P.P.S. Weird, after removing sync marks at the beginning of pivot anims I had great results but the problem appeared again after project restarting.

Okey. I try it with long stop animation but change dynamically acceleration, deceleration and braking friction factor to make continuously input and working but its too tricky. Something in this distance matching is not correct.

To anyone having issues with the Lyra pivoting animations being interrupted, I have a somewhat consistent fix (didn’t put it to a lot of test yet though)

In the UpdateAccelerationData function in main Lyra AnimBP, remove PivotDirection2D calculation and replace it with just WorldAcceleration2D (which is simply character’s acceleration in X and Y dimensions)

On the first screenshot you can see the old setup and on the second one is the current fixed setup

This issue happened because sometimes PivotDirection2D gave us a zero vector, which corresponded to “Backward” value in CardinalDirectionFromAcceleration

The issue was mostly noticeable in crouched state