In this lesson, you will learn how to align root motion data within your animation database to ensure your character's movement perfectly matches their underlying animation source.
The Importance of Root Alignment
When working with Motion Matching and large animation databases, the "Root" bone is the anchor for your character’s transformation in the world. If your animation source data contains root motion—where the hip or root bone moves forward—but your database doesn't properly track this offset, your character will "slide" or experience "foot skating" because the capsule movement won't match the skeletal pose.
To synchronize this, we must ensure that the Root Motion settings within the animation asset itself are calibrated before the data is ingested into your Animation Database.
Configuring the Animation Source
Before your database can recognize the motion, open your individual animation assets and ensure the following:
- Enable Root Motion: Within the Animation Asset Details panel, check Enable Root Motion.
- Root Motion Root Lock: Set this to Ref Pose or Anim First Frame. This locks the origin of the animation so the engine knows exactly how much translation and rotation to extract from the root bone.
- Root Motion Extraction: Ensure the
Root Motionis set to "Extract" rather than "Ignore."
Aligning the Database
Once your source animations are configured, your Motion Matching database needs to "read" this data to build the search index. In your Animation Data Asset, verify the following:
- Trajectory Generation: The database uses the root motion to predict where the character will be. If your animations are not synchronized, the predicted trajectory will drift.
- Root Delta Extraction: When you process the database, the engine calculates the delta (change) in the root’s position and orientation between frames. If you notice your character snapping or stuttering, check that the root bone is correctly defined in your Skeleton asset.
// Ensure the Root Motion is correctly flagged for the database
UAnimSequence* AnimSeq = ...;
AnimSeq->bEnableRootMotion = true;
AnimSeq->RootMotionRootLock = ERootMotionRootLock::AnimFirstFrame;
By ensuring these settings are uniform, your database will correctly index the velocity and directional changes, allowing the Motion Matching system to select poses that move the capsule in lockstep with the animation.
Key Takeaway: Properly configuring Root Motion extraction at the source is the only way to ensure your Animation Database accurately calculates character velocity, preventing foot sliding and trajectory drift.