a.AnimNode.LegIK.AveragePull
a.AnimNode.LegIK.AveragePull
#Overview
name: a.AnimNode.LegIK.AveragePull
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Leg IK AveragePull
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.AnimNode.LegIK.AveragePull is to control the behavior of the Leg IK (Inverse Kinematics) system in Unreal Engine’s animation system. Specifically, it determines whether pull averaging should be applied during the FABRIK (Forward And Backward Reaching Inverse Kinematics) solver process for leg IK.
This setting variable is primarily used in the AnimGraphRuntime module, which is part of Unreal Engine’s animation system. It’s specifically utilized in the FIKChain::SolveFABRIK function, which is responsible for solving inverse kinematics for leg chains.
The value of this variable is set as a console variable using TAutoConsoleVariable, with a default value of 1. This means it can be changed at runtime through console commands or configuration files.
The associated variable CVarAnimLegIKAveragePull directly interacts with a.AnimNode.LegIK.AveragePull. They share the same value and purpose.
Developers must be aware that this variable only has a visual impact when there are more than 2 bones (3 links) in the IK chain and when there’s some slop in the system (Slop > 1.f). When enabled (set to 1), it applies pull averaging, which can potentially create smoother or more natural-looking leg movements.
Best practices when using this variable include:
- Testing the animation with both enabled (1) and disabled (0) states to see which provides better visual results for your specific use case.
- Be aware that enabling this feature may have a slight performance cost, so consider disabling it if performance is critical and the visual improvement is minimal.
- Use in conjunction with other IK settings to fine-tune the leg animation behavior.
Regarding the associated variable CVarAnimLegIKAveragePull:
- Its purpose is identical to a.AnimNode.LegIK.AveragePull, serving as the actual console variable that controls the feature.
- It’s defined and used in the AnimGraphRuntime module, specifically in the AnimNode_LegIK.cpp file.
- Its value is set using the TAutoConsoleVariable template, which allows it to be changed at runtime.
- It’s checked using the GetValueOnAnyThread() method, which suggests it’s designed to be thread-safe for runtime modifications.
- Developers should be aware that changes to this variable will take effect immediately, potentially affecting ongoing animations.
- Best practices include using the appropriate console commands or configuration settings to modify this value, rather than hard-coding changes, to maintain flexibility in different environments (development, testing, production).
#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:669
Scope: file
Source code excerpt:
}
TAutoConsoleVariable<int32> CVarAnimLegIKAveragePull(TEXT("a.AnimNode.LegIK.AveragePull"), 1, TEXT("Leg IK AveragePull"));
void FIKChain::SolveFABRIK(const FVector& InTargetLocation, double InReachPrecision, int32 InMaxIterations)
{
// Make sure precision is not too small.
const double ReachPrecision = FMath::Max(InReachPrecision, DOUBLE_KINDA_SMALL_NUMBER);
#Associated Variable and Callsites
This variable is associated with another variable named CVarAnimLegIKAveragePull
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:669
Scope: file
Source code excerpt:
}
TAutoConsoleVariable<int32> CVarAnimLegIKAveragePull(TEXT("a.AnimNode.LegIK.AveragePull"), 1, TEXT("Leg IK AveragePull"));
void FIKChain::SolveFABRIK(const FVector& InTargetLocation, double InReachPrecision, int32 InMaxIterations)
{
// Make sure precision is not too small.
const double ReachPrecision = FMath::Max(InReachPrecision, DOUBLE_KINDA_SMALL_NUMBER);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:731
Scope (from outer to inner):
file
function void FIKChain::SolveFABRIK
Source code excerpt:
// Pull averaging only has a visual impact when we have more than 2 bones (3 links).
if ((NumLinks > 3) && (CVarAnimLegIKAveragePull.GetValueOnAnyThread() == 1) && (Slop > 1.f))
{
FIKChain ForwardPull = *this;
FABRIK_ForwardReach(InTargetLocation, ForwardPull);
FIKChain BackwardPull = *this;
FABRIK_BackwardReach(RootTargetLocation, BackwardPull);