Distance Matching {{ currentPage ? currentPage.title : "" }}

Distance matching is an animation technique used to playback an animation not by time, but by distance to a particular marker. The main advantage to this is that we can easily match our animations to our gameplay movement and not the other way around (root motion). Distance matching is the opposite of root motion, allowing full gameplay control while minimizing foot sliding and still maintaining a decent level of quality.

How It Works

Distance matching nodes take the place or regular sequence player nodes where fast and accurate movement is required. This is normally reserved for non-looping type animations where there is a specific ‘point of interest’ in the animation that a distance can be measured to / from. Some examples include:

  • Starts - distance from starting point

  • Stops - distance to stop point

  • Plants - distance to and from the point where direction changes

  • Jumps - vertical distance to the peak of the jump.

The Distance Curve

For each animation that is to use distance matching, it must first have a distance curve which stores the cumulative distance to the ‘point of interest’. The below image shows an example distance curve for a stop animation. The ‘point of interest’ is set at the end of the animation where the character comes to a complete stop. At this point the curve reads zero and the cumulative distance from this point is recorded along the curve.

How you go about creating your distance curves is up to you. However, Motion Symphony does come with animation modifiers to help generate these curves. See Animation Modifiers.

Gameplay Logic

Now that we have a distance curve to sample the animation from we need some gameplay logic to inform the distance matching node at runtime what the current distance is to the marker. Our gameplay logic needs to do a number of things including:

  • Detecting distance matching situations (i.e. detecting starts, stops, plants etc.

  • Predicting movement (to place distance markers in world space)

  • Keep track of world space markers.

Note: Motion Symphony come with a distance matching component that can be placed on the character to do a lot of this work for you. However, it is possible to create all of this logic for yourself without the component.

If our gameplay logic has triggered a distance matching ‘situation’ and we have a distance marker in world space, we can measure the distance to this marker every frame and this becomes the input into the distance matching node.

Choosing Animation Time Every Frame

Think of the distance as the animation time for a regular node. Instead of directly playing the animation with a progressive time, we find the point on the animation curve that matches the distance and then we take the time value at that point as the animation time. This process is repeated every frame until the distane matching situation is complete.

By doing this, the animation remains in sync with the character’s movement and enables animations that would normally not conform to gameplay movement to conform without modification.

Initial Setup

Setting up distance matching takes several steps each explained on it’s own page:

{{{ content }}}