Custom Optimization Module {{ currentPage ? currentPage.title : "" }}

This feature is only for very advanced users that wish to take motion matching search optimization into their own hands. A high level of experience with C++ programming and motion matching is expected for anyone attempting to create a custom optimization module and therefore, this guide will only share the bare minimum that is required to get started.

Please see the source code for the existing optimisation modules to get a better understanding of how to create your own. The TraitBins module is particularly simple and can be used as a ‘base case’.

Core Concepts

Each optimization modules is intended to store an optimized data structure for pre-processed pose data. This structure is created immediately after pre-processing via a function override.

At runtime the motion matching node will request a ‘filtered list’ of poses. The motion matching node will linearly search through the list of poses provided by the optimization module. The job of the optimization module is to provide a minimal number of poses while still achieving quality animation. How it achieves this is up to you.

Class Setup & Overrides

To create an optimization module you will need to inherit from the UMMOptimisationModule class and override three functions:

//Called immediate after the motion data is pre-processed. The input parameter is the entire motion data 
//which gives access to the entire pre-processed pose list
virtual void BuildOptimisationStructures(UMotionDataAsset* InMotionDataAsset);

//This is the runtime function which requests the filtered pose list. It provies the current pose, the
//required traits and the calibration if necessary. 
virtual TArray<FPoseMotionData>* GetFilteredPoseList(const FPoseMotionData& CurrentPose, 
        const FMotionTraitField RequiredTraits, const FCalibrationData& FinalCalibration) override;

//Can be used to initialze the optimisation module at runtime. It is not compulsory but can be useful.
virtual void InitializeRuntime() override;
{{{ content }}}