class

FMotionMatchingDatabase

Module
Animation
Header
#include "Animation/MotionMatching.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr uint32_tkSmallBlockDefault 16.
static constexpr uint32_tkLargeBlockDefault 64.

Constructors

SignatureNameDescription
FMotionMatchingDatabase() = defaultFMotionMatchingDatabase

Public functions

ReturnsNameDescription
voidStripRootTranslationDrops a sampled pose's animated root DISPLACEMENT back to the skeleton's rest transform, keeping rotation and scale.
voidSetMirrorTableThe table mirrored entries are reflected through.
boolHasMirror
const FMirrorResolved&MirrorResolved
boolBuildClips must already be bound to the skeleton (AnimationClip::BindToSkeleton).
boolBuildCachedBuild through the derived-data cache: the key is the clip/skeleton content hash + schema fingerprint + producer version, so a stale entry can never be returned.
uint64_tSourceHash
std::stringCacheKey
boolSerialize
boolDeserialize
const FMotionFeatureSchema&Schema
uint32_tFrameCount
uint32_tDimension
const std::vector<FMotionFrame>&Frames
const std::vector<float>&Features
const std::vector<float>&Mean
const std::vector<float>&StdDev
const std::vector<float>&Weights
const float*FrameFeatures
floatRawAt
voidNormalize
int32_tFindFrameFrame index playing at time in clip, or -1 when the clip is not in the database.
boolIsClipLooping
floatClipDuration
uint64_tTagMaskThe mask of the named tags this database knows; unknown names add nothing (a required unknown tag would otherwise match no frame).
const std::vector<std::string>&TagNames
floatFrameCost
int32_tSearchWeighted nearest neighbour, exact.
int32_tSearchBruteForceThe reference: every frame, no pruning.

Function details

FMotionMatchingDatabase

C++
FMotionMatchingDatabase() = default

StripRootTranslation

C++
static void StripRootTranslation(const Skeleton& skeleton, int32_t rootBone, std::vector<Mat4>& localTransforms)

Drops a sampled pose's animated root DISPLACEMENT back to the skeleton's rest transform, keeping rotation and scale. Motion-matching clips carry root motion (that is where the trajectory features come from) while the character's position is owned by its movement component — so the pose must be consumed in character space, or a switch between clips whose roots have travelled different distances teleports the skeleton.

SetMirrorTable

C++
void SetMirrorTable(const FMirrorTable& table)

The table mirrored entries are reflected through. Set it before Build / BuildCached; it is part of the cache key.

HasMirror

C++
bool HasMirror() const

MirrorResolved

C++
const FMirrorResolved& MirrorResolved() const

Build

C++
bool Build(const FMotionFeatureSchema& schema, const Skeleton& skeleton, const std::vector<Ref<AnimationClip>>& clips, const std::vector<FMotionClipEntry>& entries)

Clips must already be bound to the skeleton (AnimationClip::BindToSkeleton).

BuildCached

C++
bool BuildCached(const FMotionFeatureSchema& schema, const Skeleton& skeleton, const std::vector<Ref<AnimationClip>>& clips, const std::vector<FMotionClipEntry>& entries, bool* outCacheHit = nullptr)

Build through the derived-data cache: the key is the clip/skeleton content hash + schema fingerprint + producer version, so a stale entry can never be returned. Falls back to a plain Build when the DDC is not initialized.

SourceHash

C++
static uint64_t SourceHash(const Skeleton& skeleton, const std::vector<Ref<AnimationClip>>& clips, const std::vector<FMotionClipEntry>& entries)

CacheKey

C++
static std::string CacheKey(const FMotionFeatureSchema& schema, const Skeleton& skeleton, const std::vector<Ref<AnimationClip>>& clips, const std::vector<FMotionClipEntry>& entries)

Serialize

C++
bool Serialize(std::vector<uint8_t>& out) const

Deserialize

C++
bool Deserialize(const std::vector<uint8_t>& data)

Schema

C++
const FMotionFeatureSchema& Schema() const

FrameCount

C++
uint32_t FrameCount() const

Dimension

C++
uint32_t Dimension() const

Frames

C++
const std::vector<FMotionFrame>& Frames() const

Features

C++
const std::vector<float>& Features() const

Mean

C++
const std::vector<float>& Mean() const

StdDev

C++
const std::vector<float>& StdDev() const

Weights

C++
const std::vector<float>& Weights() const

FrameFeatures

C++
const float* FrameFeatures(uint32_t frame) const

RawAt

C++
float RawAt(uint32_t frame, uint32_t dim) const

Normalize

C++
void Normalize(const float* raw, float* outNormalized) const

FindFrame

C++
int32_t FindFrame(int32_t clipIndex, float time, bool mirrored = false) const

Frame index playing at time in clip, or -1 when the clip is not in the database. Wraps for looping clips, clamps otherwise.

IsClipLooping

C++
bool IsClipLooping(int32_t clipIndex) const

ClipDuration

C++
float ClipDuration(int32_t clipIndex) const

TagMask

C++
uint64_t TagMask(const std::vector<std::string>& tags) const

The mask of the named tags this database knows; unknown names add nothing (a required unknown tag would otherwise match no frame).

TagNames

C++
const std::vector<std::string>& TagNames() const

FrameCost

C++
float FrameCost(uint32_t frame, const float* normalizedQuery) const
C++
int32_t Search(const float* normalizedQuery, float* outCost = nullptr, const FMotionSearchFilter* filter = nullptr) const

Weighted nearest neighbour, exact. Frames are grouped in blocks of kSmallBlock inside blocks of kLargeBlock with the per-dimension bounds of each; a block whose weighted distance to the query's box already exceeds the best cost is skipped whole (Holden's AABB motion matching), so a full locomotion set searches a fraction of its frames.

SearchBruteForce

C++
int32_t SearchBruteForce(const float* normalizedQuery, float* outCost = nullptr, const FMotionSearchFilter* filter = nullptr) const

The reference: every frame, no pruning. Same answer as Search.

Generated from Animation/MotionMatching.h via animation.json · Oct 26, 2026Version 1.0.0