a.ContextualAnim.IK.DrawDebugLifetime

a.ContextualAnim.IK.DrawDebugLifetime

#Overview

name: a.ContextualAnim.IK.DrawDebugLifetime

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of a.ContextualAnim.IK.DrawDebugLifetime is to control the duration for which debug information related to Inverse Kinematics (IK) in Contextual Animation is displayed in the game world.

This setting variable is primarily used in the Contextual Animation plugin, which is an experimental animation module in Unreal Engine 5. It specifically relates to the debugging functionality of the IK system within this plugin.

The value of this variable is set as a console variable (CVar) in the ContextualAnimSceneActorComponent.cpp file. It’s initialized with a default value of 0, meaning no debug drawing by default.

The associated variable CVarContextualAnimIKDrawDebugLifetime directly interacts with a.ContextualAnim.IK.DrawDebugLifetime. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable is only active in non-shipping and non-test builds of the game. It’s wrapped in a preprocessor condition that excludes it from these builds.

Best practices when using this variable include:

  1. Only enable it during development and debugging phases.
  2. Set an appropriate lifetime value to ensure debug information is visible long enough to be useful, but not so long that it clutters the view.
  3. Use it in conjunction with the CVarContextualAnimIKDebug variable, which enables the debug drawing.

Regarding the associated variable CVarContextualAnimIKDrawDebugLifetime:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Animation/ContextualAnimation/Source/ContextualAnimation/Private/ContextualAnimSceneActorComponent.cpp:26

Scope: file

Source code excerpt:

#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
TAutoConsoleVariable<int32> CVarContextualAnimIKDebug(TEXT("a.ContextualAnim.IK.Debug"), 0, TEXT("Draw Debug IK Targets"));
TAutoConsoleVariable<float> CVarContextualAnimIKDrawDebugLifetime(TEXT("a.ContextualAnim.IK.DrawDebugLifetime"), 0, TEXT("Draw Debug Duration"));
#endif

void FContextualAnimRepData::IncrementRepCounter()
{
	static uint8 Counter = 0;
	if (Counter >= UINT8_MAX)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/Animation/ContextualAnimation/Source/ContextualAnimation/Private/ContextualAnimSceneActorComponent.cpp:26

Scope: file

Source code excerpt:

#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
TAutoConsoleVariable<int32> CVarContextualAnimIKDebug(TEXT("a.ContextualAnim.IK.Debug"), 0, TEXT("Draw Debug IK Targets"));
TAutoConsoleVariable<float> CVarContextualAnimIKDrawDebugLifetime(TEXT("a.ContextualAnim.IK.DrawDebugLifetime"), 0, TEXT("Draw Debug Duration"));
#endif

void FContextualAnimRepData::IncrementRepCounter()
{
	static uint8 Counter = 0;
	if (Counter >= UINT8_MAX)

#Loc: <Workspace>/Engine/Plugins/Experimental/Animation/ContextualAnimation/Source/ContextualAnimation/Private/ContextualAnimSceneActorComponent.cpp:1211

Scope (from outer to inner):

file
function     void UContextualAnimSceneActorComponent::UpdateIKTargets

Source code excerpt:

						if (CVarContextualAnimIKDebug.GetValueOnGameThread() > 0)
						{
							const float DrawDebugDuration = CVarContextualAnimIKDrawDebugLifetime.GetValueOnGameThread();
							DrawDebugLine(GetWorld(), IKTargetParentTransform.GetLocation(), IKTargetTransform.GetLocation(), FColor::MakeRedToGreenColorFromScalar(Alpha), false, DrawDebugDuration, 0, 0.5f);
							DrawDebugCoordinateSystem(GetWorld(), IKTargetTransform.GetLocation(), IKTargetTransform.Rotator(), 10.f, false, DrawDebugDuration, 0, 0.5f);
						}
#endif
					}
					else if (IKTargetDef.Provider == EContextualAnimIKTargetProvider::Bone)

#Loc: <Workspace>/Engine/Plugins/Experimental/Animation/ContextualAnimation/Source/ContextualAnimation/Private/ContextualAnimSceneActorComponent.cpp:1226

Scope: file

Source code excerpt:

						if (CVarContextualAnimIKDebug.GetValueOnGameThread() > 0)
						{
							const float DrawDebugDuration = CVarContextualAnimIKDrawDebugLifetime.GetValueOnGameThread();
							const FTransform IKTargetParentTransform = TargetSkelMeshComp->GetSocketTransform(TargetSkelMeshComp->GetParentBone(IKTargetDef.TargetBoneName));
							DrawDebugLine(GetWorld(), IKTargetParentTransform.GetLocation(), IKTargetTransform.GetLocation(), FColor::MakeRedToGreenColorFromScalar(Alpha), false, DrawDebugDuration, 0, 0.5f);
							DrawDebugCoordinateSystem(GetWorld(), IKTargetTransform.GetLocation(), IKTargetTransform.Rotator(), 10.f, false, DrawDebugDuration, 0, 0.5f);
						}
#endif
					}