a.AnimNode.LegIK.PullDistribution
a.AnimNode.LegIK.PullDistribution
#Overview
name: a.AnimNode.LegIK.PullDistribution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Leg IK PullDistribution. 0 = foot, 0.5 = balanced, 1.f = hip
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.AnimNode.LegIK.PullDistribution is to control the distribution of the pull effect in the Leg IK (Inverse Kinematics) system within Unreal Engine’s animation system. It determines how the IK solution is balanced between the foot and the hip.
This setting variable is primarily used in the Animation Graph Runtime module, specifically in the Leg IK bone controller system. It’s part of the animation subsystem in Unreal Engine.
The value of this variable is set through a console variable (CVar) named CVarAnimLegIKPullDistribution. It’s initialized with a default value of 0.5f, which represents a balanced distribution between the foot and hip.
The associated variable CVarAnimLegIKPullDistribution directly interacts with a.AnimNode.LegIK.PullDistribution. They share the same value and purpose.
Developers must be aware that this variable accepts values between 0 and 1:
- 0 means the pull effect is concentrated at the foot
- 0.5 (default) provides a balanced distribution
- 1 concentrates the pull effect at the hip
Best practices when using this variable include:
- Experiment with different values to achieve the desired leg IK behavior for your specific character or creature.
- Use values close to 0 for more precise foot placement and values closer to 1 for more natural-looking hip movement.
- Consider the character’s anatomy and movement style when adjusting this value.
- Use in conjunction with other Leg IK settings like MaxIterations and TargetReachStepPercent for fine-tuning the IK solution.
Regarding the associated variable CVarAnimLegIKPullDistribution:
- It’s a TAutoConsoleVariable of type float, allowing runtime adjustment of the pull distribution.
- It’s used directly in the FABRIK (Forward And Backward Reaching Inverse Kinematics) solving process within the FIKChain::SolveFABRIK function.
- The value is clamped between 0 and 1 before use, ensuring it stays within the valid range.
- Developers can modify this value at runtime using console commands, which can be useful for debugging and fine-tuning animations in real-time.
#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:18
Scope: file
Source code excerpt:
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
DECLARE_CYCLE_STAT(TEXT("LegIK Eval"), STAT_LegIK_Eval, STATGROUP_Anim);
DECLARE_CYCLE_STAT(TEXT("LegIK FABRIK Eval"), STAT_LegIK_FABRIK_Eval, STATGROUP_Anim);
#Associated Variable and Callsites
This variable is associated with another variable named CVarAnimLegIKPullDistribution
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:18
Scope: file
Source code excerpt:
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
DECLARE_CYCLE_STAT(TEXT("LegIK Eval"), STAT_LegIK_Eval, STATGROUP_Anim);
DECLARE_CYCLE_STAT(TEXT("LegIK FABRIK Eval"), STAT_LegIK_FABRIK_Eval, STATGROUP_Anim);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:677
Scope (from outer to inner):
file
function void FIKChain::SolveFABRIK
Source code excerpt:
const FVector RootTargetLocation = Links.Last().Location;
const double PullDistributionAlpha = FMath::Clamp(CVarAnimLegIKPullDistribution.GetValueOnAnyThread(), 0.0, 1.0);
// Check distance between foot and foot target location
double Slop = FVector::Dist(Links[0].Location, InTargetLocation);
if (Slop > ReachPrecision || bEnableRotationLimit)
{
if (bEnableRotationLimit)