Motion Matching: Debug visualization improvements
* Moved reposibility from the instance to the system component to render debug visualizations. Why? To make sure all motion extraction deltas got applied to the character already and avoid any mismatches between last and current frame (resulting in visual jittering). * Added frame database stats to the ImGui monitor. * Switched ImGuiMonitor from internal histogram group to the now shared version in LYImGuiUtils. * Added a new debug draw bus that the motion matching instance hooks to, so that the system component can control when to render debug visualizations. * Added class description for the motion matching instance. Signed-off-by: Benjamin Jillich <jillich@amazon.com>
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
#include <TrajectoryHistory.h>
|
||||
#include <TrajectoryQuery.h>
|
||||
|
||||
#include <MotionMatching/MotionMatchingBus.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
class ReflectContext;
|
||||
@@ -34,12 +36,17 @@ namespace EMotionFX::MotionMatching
|
||||
{
|
||||
class MotionMatchingData;
|
||||
|
||||
//! The instance is where everything comes together. It stores the trajectory history, the trajectory query along with the query vector, knows about the
|
||||
//! last lowest cost frame frame index and stores the time of the animation that the instance is currently playing. It is responsible for motion extraction,
|
||||
//! blending towards a new frame in the motion capture database in case the algorithm found a better matching frame and executes the actual search.
|
||||
class EMFX_API MotionMatchingInstance
|
||||
: public DebugDrawRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(MotionMatchingInstance, "{1ED03AD8-0FB2-431B-AF01-02F7E930EB73}")
|
||||
AZ_CLASS_ALLOCATOR_DECL
|
||||
|
||||
MotionMatchingInstance() = default;
|
||||
virtual ~MotionMatchingInstance();
|
||||
|
||||
struct EMFX_API InitSettings
|
||||
@@ -49,8 +56,8 @@ namespace EMotionFX::MotionMatching
|
||||
};
|
||||
void Init(const InitSettings& settings);
|
||||
|
||||
void DebugDraw();
|
||||
void DebugDraw(AzFramework::DebugDisplayRequests& debugDisplay);
|
||||
// DebugDrawRequestBus::Handler overrides
|
||||
void DebugDraw(AzFramework::DebugDisplayRequests& debugDisplay) override;
|
||||
|
||||
void Update(float timePassedInSeconds, const AZ::Vector3& targetPos, const AZ::Vector3& targetFacingDir, TrajectoryQuery::EMode mode, float pathRadius, float pathSpeed);
|
||||
void PostUpdate(float timeDelta);
|
||||
@@ -64,10 +71,8 @@ namespace EMotionFX::MotionMatching
|
||||
void SetLowestCostSearchFrequency(float frequency) { m_lowestCostSearchFrequency = frequency; }
|
||||
float GetNewMotionTime() const { return m_newMotionTime; }
|
||||
|
||||
/**
|
||||
* Get the cached trajectory feature.
|
||||
* The trajectory feature is searched in the feature schema used in the current instance at init time.
|
||||
*/
|
||||
//! Get the cached trajectory feature.
|
||||
//! The trajectory feature is searched in the feature schema used in the current instance at init time.
|
||||
FeatureTrajectory* GetTrajectoryFeature() const { return m_cachedTrajectoryFeature; }
|
||||
const TrajectoryQuery& GetTrajectoryQuery() const { return m_trajectoryQuery; }
|
||||
const TrajectoryHistory& GetTrajectoryHistory() const { return m_trajectoryHistory; }
|
||||
@@ -90,10 +95,10 @@ namespace EMotionFX::MotionMatching
|
||||
Transform m_motionExtractionDelta = Transform::CreateIdentity();
|
||||
|
||||
/// Buffers used for the broad-phase KD-tree search.
|
||||
AZStd::vector<float> m_queryFeatureValues; /** The input query features to be compared to every entry/row in the feature matrix with the motion matching search. */
|
||||
AZStd::vector<size_t> m_nearestFrames; /** Stores the nearest matching frames / search result from the KD-tree. */
|
||||
AZStd::vector<float> m_queryFeatureValues; //< The input query features to be compared to every entry/row in the feature matrix with the motion matching search.
|
||||
AZStd::vector<size_t> m_nearestFrames; //< Stores the nearest matching frames / search result from the KD-tree.
|
||||
|
||||
FeatureTrajectory* m_cachedTrajectoryFeature = nullptr; /** Cached pointer to the trajectory feature in the feature schema. */
|
||||
FeatureTrajectory* m_cachedTrajectoryFeature = nullptr; //< Cached pointer to the trajectory feature in the feature schema.
|
||||
TrajectoryQuery m_trajectoryQuery;
|
||||
TrajectoryHistory m_trajectoryHistory;
|
||||
static constexpr float m_trajectorySecsToTrack = 5.0f;
|
||||
@@ -105,7 +110,7 @@ namespace EMotionFX::MotionMatching
|
||||
|
||||
bool m_blending = false;
|
||||
float m_blendWeight = 1.0f;
|
||||
float m_blendProgressTime = 0.0f; // How long are we already blending? In seconds.
|
||||
float m_blendProgressTime = 0.0f; //< How long are we already blending? In seconds.
|
||||
|
||||
/// Buffers used for FindLowestCostFrameIndex().
|
||||
AZStd::vector<float> m_tempCosts;
|
||||
|
||||
Reference in New Issue
Block a user