a.AnimNode.LegIK.EnableTwoBone
a.AnimNode.LegIK.EnableTwoBone
#Overview
name: a.AnimNode.LegIK.EnableTwoBone
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable Two Bone Code Path.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.AnimNode.LegIK.EnableTwoBone is to enable or disable the Two Bone IK (Inverse Kinematics) code path in the Leg IK animation system. This setting variable is specifically for the animation system in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Animation Graph Runtime, particularly the Leg IK bone controller. This can be inferred from the file path “AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp”.
The value of this variable is set using a console variable (CVarAnimLegIKTwoBone) with a default value of 1, which means the Two Bone IK code path is enabled by default.
The associated variable CVarAnimLegIKTwoBone interacts directly with a.AnimNode.LegIK.EnableTwoBone. They share the same value and purpose.
Developers must be aware that this variable controls a specific optimization for IK calculations. When enabled (set to 1), it allows for an instant solution for IK chains with exactly three links (two bones), bypassing the iterative FABRIK approach used for chains with different numbers of links.
Best practices when using this variable include:
- Leave it enabled (default value of 1) for optimal performance in most cases.
- Only disable it if you encounter specific issues with two-bone IK chains and need to force the use of the more general FABRIK algorithm.
- Be cautious when changing this value at runtime, as it could lead to sudden changes in animation behavior.
Regarding the associated variable CVarAnimLegIKTwoBone:
The purpose of CVarAnimLegIKTwoBone is to provide a console-accessible way to control the a.AnimNode.LegIK.EnableTwoBone setting. It’s part of the animation system, specifically the Leg IK functionality.
This console variable is defined and used within the Animation Graph Runtime module, as seen in the AnimNode_LegIK.cpp file.
The value of CVarAnimLegIKTwoBone is set when the console variable is initialized, with a default value of 1. It can be changed at runtime through console commands.
CVarAnimLegIKTwoBone directly interacts with the a.AnimNode.LegIK.EnableTwoBone setting, effectively controlling its value.
Developers should be aware that this console variable allows for runtime toggling of the Two Bone IK optimization. It’s checked in the IK solving logic to determine whether to use the specialized two-bone solution or the general FABRIK algorithm.
Best practices for using CVarAnimLegIKTwoBone include:
- Use it for debugging or testing purposes when you need to quickly toggle the Two Bone IK optimization.
- Be cautious when changing its value in a shipping game, as it could affect performance and animation quality.
- Consider exposing this option in a debug menu for easier testing and troubleshooting of IK-related issues.
#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:262
Scope: file
Source code excerpt:
}
TAutoConsoleVariable<int32> CVarAnimLegIKTwoBone(TEXT("a.AnimNode.LegIK.EnableTwoBone"), 1, TEXT("Enable Two Bone Code Path."));
void FIKChain::ReachTarget(
const FVector& InTargetLocation,
double InReachPrecision,
int32 InMaxIterations,
float SoftPercentLength,
#Associated Variable and Callsites
This variable is associated with another variable named CVarAnimLegIKTwoBone
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:262
Scope: file
Source code excerpt:
}
TAutoConsoleVariable<int32> CVarAnimLegIKTwoBone(TEXT("a.AnimNode.LegIK.EnableTwoBone"), 1, TEXT("Enable Two Bone Code Path."));
void FIKChain::ReachTarget(
const FVector& InTargetLocation,
double InReachPrecision,
int32 InMaxIterations,
float SoftPercentLength,
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_LegIK.cpp:295
Scope (from outer to inner):
file
function void FIKChain::ReachTarget
Source code excerpt:
}
// Two Bones, we can figure out solution instantly
else if (NumLinks == 3 && (CVarAnimLegIKTwoBone.GetValueOnAnyThread() == 1))
{
SolveTwoBoneIK(FinalTargetLocation);
}
// Do iterative approach based on FABRIK
else
{