Distance matching is an animation technique used to playback an animation not by time passed but by distance to a particular marker (e.g. in a stop animation, the marker is at the stop point and distance is measured to that 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.
For more details on the distance matching technique, please read the section of this manual dedicated to distance matching.
Distance Matching and Motion Matching
The goal of integrating distance matching into the motion matching soup is to get the best of both worlds. Motion Matching provides high fidelity animation with quality automatic transitions to the closest pose, while distance matching conforms our animation to the character’s movement. By combining the two, the gap between quality and responsiveness can be narrowed.
Just like the Distance Matching node, distance matching within the ‘Motion Matching’ node needs to be triggered via gameplay logic using the distance matching component. This generates a distance matching payload that can be used as an input into the motion matching node.
Whenever a payload triggers a ‘distance match’ animation, the motion matching node will search through all the relevant ‘distance matching’ situations and pick the one that best suites both the character’s current pose and the distance matching specifications. It will then play that distance matched animation until the distance matching requirements are satisfied or until the distance matching is cancelled by other game logic. Regular motion matching will resume immediately after.
Distance Matching Markers
In order to use distance matching within motion matching, distance markers first need to be set up in your ‘Motion Data’ asset. Distance markers take the form of tags and can be easily added to the tag timeline of any animation. The following steps will explain how to add these markers and how to configure them for pre-processing.
Step 1: Add a distance matching marker on the tag timeline as shown below:
Step 2: Select the marker tag and configure it’s settings in the contextual details panel to the bottom left of the editor window.
Distance Match Type - The type of distance matching that this marker is for (see Distance Matching)
None - No distance matching
Backward - The distance is measured backward to the distance marker (for start type animations)
Forward - The distance is measured forward towards the distance marker (for stop type animations)
Both - The distance is measured both backward and forward from the distance marker (for plant type animations.
Distance Match Basis - The type of distance being measure, either positional or rotational
Positional - distance is measured in center meters
Rotational - distance is measured rotationally for matching pivots and turns.
Lead - How much time to generate a distance curve prior to this marker. Leave enough time that would be needed in a realistic gameplay situation where this marker would be used. There is no need for any lead time on a ‘Backward’ matching type.
Tail - How much time to generate a distance curve following this marker. Leave enough time that would be needed in a realistic gameplay situation where this marker would be used. There is no need for any tail time on a ‘Forward’ matching type.
Step 3: Don’t forget to pre-process your data.