a.MotionTrajectory.Options

a.MotionTrajectory.Options

#Overview

name: a.MotionTrajectory.Options

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.Options is to control the debug information displayed for motion trajectory samples in Unreal Engine’s animation system. This console variable allows developers to toggle various types of information for visualization and debugging purposes.

This setting variable is primarily used in the animation system of Unreal Engine, specifically in the motion trajectory functionality. Based on the callsites, it’s part of the Engine module and is utilized in the MotionTrajectoryTypes.cpp file.

The value of this variable is set through the console command system, as it’s defined as a TAutoConsoleVariable. It can be changed at runtime using the console command “a.MotionTrajectory.Options [value]”.

The a.MotionTrajectory.Options variable interacts with two other variables:

  1. CVarMotionTrajectoryDebug: Controls whether debug drawing for motion trajectory is enabled.
  2. CVarMotionTrajectoryDebugStride: Configures the sample stride when displaying information.

Developers must be aware that this variable uses a bitmask to toggle different types of information. The options are: 0. Disable Text

  1. Index
  2. Accumulated Time
  3. Position
  4. Velocity
  5. Acceleration

When using this variable, developers should consider the following best practices:

  1. Use it in conjunction with CVarMotionTrajectoryDebug to ensure debug drawing is enabled.
  2. Be mindful of performance impact when enabling multiple debug options, especially in production builds.
  3. Use CVarMotionTrajectoryDebugStride to control the density of debug information displayed.

The associated variable CVarMotionTrajectoryDebugOptions is an internal representation of the a.MotionTrajectory.Options console variable. It’s used within the C++ code to access the current value of the setting. The purpose and usage are the same as a.MotionTrajectory.Options.

This variable is accessed using the GetValueOnAnyThread() method, which suggests it can be safely read from any thread. Developers should be aware that changes to this variable may not be immediately reflected in all parts of the engine due to potential caching or update delays.

Best practices for using CVarMotionTrajectoryDebugOptions include:

  1. Always use GetValueOnAnyThread() to access its value for thread-safety.
  2. Consider caching the value if it’s accessed frequently in performance-critical code sections.
  3. Be aware that changes to this value at runtime will affect the debug visualization of motion trajectories.

#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:21

Scope: file

Source code excerpt:

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
{
	template<class U> static inline U CubicCRSplineInterpSafe(const U& P0, const U& P1, const U& P2, const U& P3, const float I, const float A = 0.5f)
	{

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

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
{
	template<class U> static inline U CubicCRSplineInterpSafe(const U& P0, const U& P1, const U& P2, const U& P3, const float I, const float A = 0.5f)
	{

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

Scope (from outer to inner):

file
function     void FTrajectorySampleRange::DebugDrawTrajectory

Source code excerpt:

#if ENABLE_ANIM_DEBUG
			const int32 DebugSampleStride = CVarMotionTrajectoryDebugStride.GetValueOnAnyThread();
			const int32 DebugSampleOptions = CVarMotionTrajectoryDebugOptions.GetValueOnAnyThread();
#endif
			for (int32 Idx = 0, Num = Samples.Num(); Idx < Num; Idx++)
			{
				const FTransform SampleTransformWS = Samples[Idx].Transform * WorldTransform;
				const FVector SamplePositionWS = SampleTransformWS.GetTranslation();