a.AnimNode.LegIK.Debug

a.AnimNode.LegIK.Debug

#Overview

name: a.AnimNode.LegIK.Debug

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

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of a.AnimNode.LegIK.Debug is to enable debugging for the FAnimNode_LegIK animation node in Unreal Engine’s animation system. This setting variable is used to control the visibility of debug information related to leg inverse kinematics (IK) calculations.

This setting variable is primarily used in the AnimGraphRuntime module, specifically within the LegIK animation node implementation. It’s part of the animation system in Unreal Engine.

The value of this variable is set as a console variable (CVar) with an initial value of 0, meaning debug mode is off by default. It can be toggled on by setting it to 1 through the console or configuration files.

The associated variable CVarAnimNodeLegIKDebug directly interacts with a.AnimNode.LegIK.Debug. They share the same value and purpose.

Developers must be aware that this debug variable is only effective when ENABLE_ANIM_DEBUG is defined, which is typically only in development builds. In production builds, this debugging functionality is usually stripped out for performance reasons.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging leg IK issues.
  2. Remember to disable it after debugging to avoid performance overhead.
  3. Use it in conjunction with other animation debugging tools for a comprehensive view of the animation system’s behavior.

The associated variable CVarAnimNodeLegIKDebug is used throughout the LegIK implementation to check if debug mode is enabled. When enabled, it triggers various debug drawing functions to visualize the leg IK calculations, including:

Developers should use this variable when they need to visually inspect the behavior of the LegIK system, particularly when troubleshooting issues with leg positioning or when fine-tuning the IK parameters.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:12

Scope: file

Source code excerpt:


#if ENABLE_ANIM_DEBUG
TAutoConsoleVariable<int32> CVarAnimNodeLegIKDebug(TEXT("a.AnimNode.LegIK.Debug"), 0, TEXT("Turn on debug for FAnimNode_LegIK"));
#endif

TAutoConsoleVariable<int32> CVarAnimLegIKEnable(TEXT("a.AnimNode.LegIK.Enable"), 1, TEXT("Toggle LegIK node."));
TAutoConsoleVariable<int32> CVarAnimLegIKMaxIterations(TEXT("a.AnimNode.LegIK.MaxIterations"), 0, TEXT("Leg IK MaxIterations override. 0 = node default, > 0 override."));
TAutoConsoleVariable<float> CVarAnimLegIKTargetReachStepPercent(TEXT("a.AnimNode.LegIK.TargetReachStepPercent"), 0.7f, TEXT("Leg IK TargetReachStepPercent."));
TAutoConsoleVariable<float> CVarAnimLegIKPullDistribution(TEXT("a.AnimNode.LegIK.PullDistribution"), 0.5f, TEXT("Leg IK PullDistribution. 0 = foot, 0.5 = balanced, 1.f = hip"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:12

Scope: file

Source code excerpt:


#if ENABLE_ANIM_DEBUG
TAutoConsoleVariable<int32> CVarAnimNodeLegIKDebug(TEXT("a.AnimNode.LegIK.Debug"), 0, TEXT("Turn on debug for FAnimNode_LegIK"));
#endif

TAutoConsoleVariable<int32> CVarAnimLegIKEnable(TEXT("a.AnimNode.LegIK.Enable"), 1, TEXT("Toggle LegIK node."));
TAutoConsoleVariable<int32> CVarAnimLegIKMaxIterations(TEXT("a.AnimNode.LegIK.MaxIterations"), 0, TEXT("Leg IK MaxIterations override. 0 = node default, > 0 override."));
TAutoConsoleVariable<float> CVarAnimLegIKTargetReachStepPercent(TEXT("a.AnimNode.LegIK.TargetReachStepPercent"), 0.7f, TEXT("Leg IK TargetReachStepPercent."));
TAutoConsoleVariable<float> CVarAnimLegIKPullDistribution(TEXT("a.AnimNode.LegIK.PullDistribution"), 0.5f, TEXT("Leg IK PullDistribution. 0 = foot, 0.5 = balanced, 1.f = hip"));

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:87

Scope (from outer to inner):

file
function     void FAnimLegIKData::InitializeTransforms

Source code excerpt:


#if ENABLE_ANIM_DEBUG && ENABLE_DRAW_DEBUG
	const bool bShowDebug = (CVarAnimNodeLegIKDebug.GetValueOnAnyThread() == 1);
	if (bShowDebug)
	{
		DrawDebugLeg(*this, MyAnimInstanceProxy, FColor::Red);
		MyAnimInstanceProxy->AnimDrawDebugSphere(GetBoneWorldLocation(IKFootTransform, MyAnimInstanceProxy), 4.f, 4, FColor::Red, false, -1.f, 2.f);
	}
#endif // ENABLE_ANIM_DEBUG && ENABLE_DRAW_DEBUG

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:141

Scope (from outer to inner):

file
function     void FAnimNode_LegIK::EvaluateSkeletalControl_AnyThread

Source code excerpt:


#if ENABLE_ANIM_DEBUG
		const bool bShowDebug = (CVarAnimNodeLegIKDebug.GetValueOnAnyThread() == 1);
		if (bShowDebug)
		{
			FString DebugString = FString::Printf(TEXT("Limb[%d/%d] (%s) bModifiedLimb(%d) bOrientedLegTowardsIK(%d) bDidLegReachIK(%d) bAdjustedKneeTwist(%d) bOverrideFootFKRotation(%d)"),
				LimbIndex + 1, LegsData.Num(), *LegData.LegDefPtr->FKFootBone.BoneName.ToString(), 
				bModifiedLimb, bOrientedLegTowardsIK, bDidLegReachIK, bAdjustedKneeTwist, bOverrideFootFKRotation);
			MyAnimInstanceProxy->AnimDrawDebugOnScreenMessage(DebugString, FColor::Red);

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:202

Scope (from outer to inner):

file
function     bool FAnimNode_LegIK::OrientLegTowardsIK

Source code excerpt:

	{
#if ENABLE_ANIM_DEBUG
		const bool bShowDebug = (CVarAnimNodeLegIKDebug.GetValueOnAnyThread() == 1);
		if (bShowDebug)
		{
			DrawDebugLeg(InLegData, MyAnimInstanceProxy, FColor::Green);
		}
#endif
		return true;

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:468

Scope (from outer to inner):

file
function     bool FAnimNode_LegIK::DoLegReachIK

Source code excerpt:


#if ENABLE_ANIM_DEBUG
	const bool bShowDebug = (CVarAnimNodeLegIKDebug.GetValueOnAnyThread() == 1);
	if (bShowDebug)
	{
		DrawDebugLeg(InLegData, MyAnimInstanceProxy, FColor::Yellow);
	}
#endif

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:705

Scope (from outer to inner):

file
function     void FIKChain::SolveFABRIK

Source code excerpt:


#if ENABLE_ANIM_DEBUG
		const bool bShowDebug = (CVarAnimNodeLegIKDebug.GetValueOnAnyThread() == 1);
		if (bShowDebug)
		{
			DrawDebugIKChain(*this, FColor::Magenta);
		}
#endif

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:821

Scope (from outer to inner):

file
function     bool FAnimNode_LegIK::AdjustKneeTwist

Source code excerpt:

	{
#if ENABLE_ANIM_DEBUG
		const bool bShowDebug = (CVarAnimNodeLegIKDebug.GetValueOnAnyThread() == 1);
		if (bShowDebug)
		{
			DrawDebugLeg(InLegData, MyAnimInstanceProxy, FColor::Magenta);
		}
#endif
		return true;