a.AnimNode.LegIK.PullDistribution

a.AnimNode.LegIK.PullDistribution

#Overview

name: a.AnimNode.LegIK.PullDistribution

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

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:

Best practices when using this variable include:

  1. Experiment with different values to achieve the desired leg IK behavior for your specific character or creature.
  2. Use values close to 0 for more precise foot placement and values closer to 1 for more natural-looking hip movement.
  3. Consider the character’s anatomy and movement style when adjusting this value.
  4. Use in conjunction with other Leg IK settings like MaxIterations and TargetReachStepPercent for fine-tuning the IK solution.

Regarding the associated variable CVarAnimLegIKPullDistribution:

#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)