a.MotionTrajectory.Debug

a.MotionTrajectory.Debug

#Overview

name: a.MotionTrajectory.Debug

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of a.MotionTrajectory.Debug is to enable debug drawing for motion trajectory in Unreal Engine’s animation system. This console variable is used to control the visualization of motion trajectory data, which can be helpful for developers and animators to understand and troubleshoot animation behavior.

The Unreal Engine subsystem that relies on this setting variable is the Animation system, specifically the Motion Trajectory component. This can be seen from the file location (MotionTrajectoryTypes.cpp) and the context of the code.

The value of this variable is set through the console or configuration files. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands.

This variable interacts with two other variables:

  1. CVarMotionTrajectoryDebugStride: Controls the sample stride when displaying information.
  2. CVarMotionTrajectoryDebugOptions: Toggles different types of motion trajectory sample information to display.

Developers should be aware that:

  1. This is a debug feature and should be used primarily during development and testing.
  2. Enabling this feature may have performance implications, especially in complex scenes or with many animated objects.
  3. The debug drawing is only visible when ENABLE_ANIM_DEBUG is defined.

Best practices when using this variable include:

  1. Use it in conjunction with CVarMotionTrajectoryDebugStride and CVarMotionTrajectoryDebugOptions for more detailed debugging.
  2. Remember to disable it in release builds or when performance is a concern.
  3. Use it to verify that motion trajectories are behaving as expected in your animations.

Regarding the associated variable CVarMotionTrajectoryDebug: This is the actual console variable object that controls the debug drawing. It’s initialized with the same value and description as a.MotionTrajectory.Debug. The purpose and usage are identical to a.MotionTrajectory.Debug, as it’s the implementation of the console variable in the C++ code.

Developers interact with this variable in the code by calling CVarMotionTrajectoryDebug.GetValueOnAnyThread() to check if debug drawing should be enabled. This is typically done in conditional statements to determine whether to execute debug drawing code.

When using CVarMotionTrajectoryDebug, developers should be aware that it’s checked in performance-critical sections of the animation system. Therefore, frequent changes to this variable at runtime could potentially impact performance.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/MotionTrajectoryTypes.cpp:19

Scope: file

Source code excerpt:

static const FVector DebugSampleOffset(0.f, 0.f, 10.f);

TAutoConsoleVariable<int32> CVarMotionTrajectoryDebug(TEXT("a.MotionTrajectory.Debug"), 0, TEXT("Turn on debug drawing for motion trajectory"));
TAutoConsoleVariable<int32> CVarMotionTrajectoryDebugStride(TEXT("a.MotionTrajectory.Stride"), 1, TEXT("Configure the sample stride when displaying information"));
TAutoConsoleVariable<int32> CVarMotionTrajectoryDebugOptions(TEXT("a.MotionTrajectory.Options"), 0, TEXT("Toggle motion trajectory sample information:\n 0. Disable Text\n 1. Index\n2. Accumulated Time\n 3. Position\n 4. Velocity\n 5. Acceleration"));
#endif

namespace
{

#Associated Variable and Callsites

This variable is associated with another variable named CVarMotionTrajectoryDebug. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/MotionTrajectoryTypes.cpp:19

Scope: file

Source code excerpt:

static const FVector DebugSampleOffset(0.f, 0.f, 10.f);

TAutoConsoleVariable<int32> CVarMotionTrajectoryDebug(TEXT("a.MotionTrajectory.Debug"), 0, TEXT("Turn on debug drawing for motion trajectory"));
TAutoConsoleVariable<int32> CVarMotionTrajectoryDebugStride(TEXT("a.MotionTrajectory.Stride"), 1, TEXT("Configure the sample stride when displaying information"));
TAutoConsoleVariable<int32> CVarMotionTrajectoryDebugOptions(TEXT("a.MotionTrajectory.Options"), 0, TEXT("Toggle motion trajectory sample information:\n 0. Disable Text\n 1. Index\n2. Accumulated Time\n 3. Position\n 4. Velocity\n 5. Acceleration"));
#endif

namespace
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/MotionTrajectoryTypes.cpp:201

Scope (from outer to inner):

file
function     void FTrajectorySampleRange::DebugDrawTrajectory

Source code excerpt:

	if (bEnable
#if ENABLE_ANIM_DEBUG
		|| CVarMotionTrajectoryDebug.GetValueOnAnyThread()
#endif
		)
	{
		if (World)
		{
#if ENABLE_ANIM_DEBUG