a.AnimNode.LegIK.Enable
a.AnimNode.LegIK.Enable
#Overview
name: a.AnimNode.LegIK.Enable
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Toggle LegIK node.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.AnimNode.LegIK.Enable is to toggle the Leg IK (Inverse Kinematics) node functionality in Unreal Engine’s animation system. This setting variable is used to control whether the Leg IK calculations should be performed or not.
-
The Unreal Engine animation system, specifically the AnimGraphRuntime module, relies on this setting variable. It’s used in the implementation of the Leg IK node, which is part of the animation graph system.
-
The value of this variable is set as a console variable (CVar) with a default value of 1 (enabled). It can be changed at runtime through the console or programmatically.
-
This variable interacts with the associated variable CVarAnimLegIKEnable, which is the actual CVar object. They share the same value and purpose.
-
Developers must be aware that this variable directly impacts the performance and behavior of character animations using Leg IK. Disabling it (setting to 0) will prevent Leg IK calculations from being performed, which might be useful for debugging or performance optimization in certain scenarios.
-
Best practices when using this variable include:
- Use it for debugging or performance profiling purposes.
- Be cautious when disabling it in production, as it may significantly affect the quality of character animations.
- Consider exposing this setting in development builds for easier testing and tweaking.
Regarding the associated variable CVarAnimLegIKEnable:
The purpose of CVarAnimLegIKEnable is to provide programmatic access to the a.AnimNode.LegIK.Enable setting within the C++ code of Unreal Engine.
-
It’s used in the AnimGraphRuntime module, specifically in the implementation of the FAnimNode_LegIK class.
-
The value of this variable is set when the engine initializes the console variables, but it can be changed at runtime using console commands or C++ code.
-
This variable is used in the IsValidToEvaluate function of the FAnimNode_LegIK class to determine whether the Leg IK node should be evaluated.
-
Developers should be aware that changing this variable’s value will have an immediate effect on all Leg IK nodes in the current game instance.
-
Best practices for using this variable include:
- Use GetValueOnAnyThread() when accessing the value, as shown in the provided code snippet.
- Consider caching the value if it’s accessed frequently in performance-critical code sections.
- Be mindful of threading issues if modifying this value from multiple threads.
#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:15
Scope: file
Source code excerpt:
#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"));
/////////////////////////////////////////////////////
// FAnimAnimNode_LegIK
#Associated Variable and Callsites
This variable is associated with another variable named CVarAnimLegIKEnable
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:15
Scope: file
Source code excerpt:
#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"));
/////////////////////////////////////////////////////
// FAnimAnimNode_LegIK
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:835
Scope (from outer to inner):
file
function bool FAnimNode_LegIK::IsValidToEvaluate
Source code excerpt:
bool FAnimNode_LegIK::IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones)
{
const bool bIsEnabled = (CVarAnimLegIKEnable.GetValueOnAnyThread() == 1);
return bIsEnabled && (LegsData.Num() > 0);
}
static void PopulateLegBoneIndices(FAnimLegIKData& InLegData, const FCompactPoseBoneIndex& InFootBoneIndex, const int32& NumBonesInLimb, const FBoneContainer& RequiredBones)
{
FCompactPoseBoneIndex BoneIndex = InFootBoneIndex;