Here's how to use the new Distance Matching feature in Preview 1

Here’s the forum post I wish existed when I was trying to sort this out. Could have saved me a number of hours :wink:

First you need to install the Animation Locomotion Library plugin.

Next, select any AnimNode in your graph and you’ll see a place for an Update function:

Select the option there to create a binding, and you’ll be presented with a Blueprint graph where you can use one of the three Distance Matching nodes. Here’s an example of setting up the AdvanceTimeByDistanceMatching node:

Your animations are going to need a distance curve on them. You can use the DistanceCurveModifier to generate a distance curve, but of course this only works with animations that have root motion. Otherwise there’s no data to generate the curve from. Here’s how to generate the curve: open your animation and then go to the Animation Data Modifiers window.

Click Add Modifier, and then select DistanceCurveModifier:

I hope this helps someone!


A quick addendum:

I said above you can bind the Update function on any AnimNode. That’s incorrect. For the AdvanceTimeByDistanceMatching and DistanceMatchToTarget functions, you need to use a SequenceEvaluator node, and you need to set Explicit Time to be Dynamic:

You may also want to bind a function to On Become Relevant that resets the ExplicitTime of the animation. Otherwise the next time the node becomes relevant, it will try and start playing where it left off before (which might mean the animation appears to freeze on the last frame):


One other thing I forgot to mention: your animations need to use Uniform Indexable compression for the Curve Compression Settings. In your animation asset details, you’ll need to create and apply a compression asset that uses Uniform Indexable compression:


Once you’ve selected your compression asset, don’t forget to apply it:


Hey, thank you for posting this tutorial in here. I wanted to give it a shot with distance matching, but I ran into a few problems. One of them being the freeze animation on Stop. I followed exactly your steps, but somehow I get the stop animation to freeze with one foot in the air. You said something about explicit time. How and where did you set it?

When you select your Sequence Evaluator node, in the details panel you should see Explicit Time. If you click the dropdown to the right of that, you can select Dynamic. Depending on your animation, you might also want to make sure to uncheck Should Loop.

You can also open the Output Log (it’s under Window → Output Log). When you run your game, look in there to see if there are any warning messages about your animations.

1 Like

I have an animbp with the functionality based on the Paragon Twinblast (Logic wise). Animbp contains 4 state machines: Idle, Start, Loop and Stop. Only start and stop state machines use the sequence evaluator node. Explicit time is set to both on dynamic. Both events are binded. Both animations are set not to loop. Compression curve was set to the according settings/codec. In the output log, there is no warning regarding animations. I can’t explain why the freeze occurs on the stop animation tho…

Unfortunately I don’t have any way to know what the problem could be. You could try doing Print String from inside your distance matching function. It won’t show up on the screen like normal, but it will show up in the output log. Maybe the function isn’t running for some reason, or maybe it’s unable to convert the Sequence Evaluator Reference for some reason.

1 Like

It could be that the distance matching isn’t fast forwarding your stop animation to the end of it, and depending on your anim graph setup, it might not ever go to the next node in the state machine. Instead of using the On Become Relevant function to reset the ExplicitTime, you might use it to set the ExplicitTime to the correct value to allow the animation to finish playing as the character comes to a full stop. You can use the DistanceMatchToTarget function for that, and you can use the PredictGroundMovementStopLocation to calculate the distance needed.

In my character BP I have this:

Then I pass PredictedStopDistance to my AnimBP via a BPI (though you could do it however you want). Then in the On Become Relevant function for my stop node I have this:

1 Like

Somehow it seems that my state machines are not getting the right flow. They remain stuck, for some reason and blends between Start and Stop. However I did manage to make it work following your guidelines.

im using Distance matching feature for pivot, but i dont know why there is some glitch in the animation, even though i use time dilation to check the glitch it wont effected by time dilation

ahhh ,I do everything in the tutorial here and from youtube , official unreal manual but for me my actor freeze in pose. Nothing help i dont get it

okey that is my fix in prediction

1 Like

Has anyone experienced issues when testing distance matching for multiplayer? For me my locally controlled characters play the stop animation correctly; however, simulated proxies stop in place or sometimes don’t even play the stop animation at all and just stop moving entirely. I thought curves were read on all AnimBP instances, but, for some reason, it’s like the distance curve isn’t read on simulated proxies.

I seen this in a modified Lyra Project when I was setting it up and as you said it isn’t affected by time dilation, but after recording it in slowmo I was about to play the video back and step through the video frame by frame until I seen it. Come to find out the issue for me was actually Foot Sync Markers. In Lyra I didn’t realize this but if you look at their pivot animations the first part of the Pivot does not actually have Foot Sync Markers, If you go back and use the Anim Modifier to generate them you will see it places them there automatically…so they must have removed those sync markers to fix their issue. I did this and that issue went away…even the Start and Stop transitions I replaced had the issue, so I went through and removed the Sync Markers from around the time that the issue occurred on the animation, and this fixed this issue for me.

Hey man, so I’ve noticed a serious spam bug in Lyra…

Let me explain the bug:
When spamming keys blending between animations seems to be thrown out the window, you will notice pose popping, where poses instantly change with no blending between. If you run this in slow motion it becomes more obvious the slower you go because your able to spam the keys at a faster rate.

The source seems to point to the Transition animations Start/Stop/Pivot each of these are setup like this to use Distance Matching…If I replace these with Sequence Players in a State Machine with no Distance Matching…the Spam Bug goes 100% completely away…of course this introduced foot sliding especially during pivots…I’m not really sure exactly what it is about this setup that’s causing the issue, but it’s not the fact that they select the animation from the On Become Relevant function because it still had this problem when I was using State Machines with Distance Matching…Do you have any clue what is causing this? Have you experienced it yourself? And Do you know of any solution too it?

After serious experimentation I don’t think that this issue is related to their setup or logic at all…I think it’s an unavoidable side-effect of transition animations since they aren’t loop-able.

I say this because when I setup all this logic on state machines running simple Sequence Player Animations the issue was still there…even after removing Orientation Warping and Stride Warping from them. This seems to indicate that you can’t have transition animations without pose popping during key spamming.