p.AnimDynamics
p.AnimDynamics
#Overview
name: p.AnimDynamics
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables/Disables anim dynamics node updates.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.AnimDynamics is to enable or disable anim dynamics node updates in Unreal Engine’s animation system. This console variable controls the overall functionality of the AnimDynamics feature, which is used for simulating dynamic physics-based animations.
The Unreal Engine subsystem that relies on this setting variable is primarily the animation system, specifically the AnimGraphRuntime module. This can be seen from the file location where the variable is defined and used: Engine/Source/Runtime/AnimGraphRuntime/
.
The value of this variable is set as a console variable, with a default value of 1 (enabled). It can be changed at runtime through the console or programmatically.
There are several other variables that interact with p.AnimDynamics:
- CVarRestrictLod: Restricts anim dynamics to a specific LOD level.
- CVarLODThreshold: Sets a global LOD threshold for anim dynamics.
- CVarEnableAdaptiveSubstep: Enables or disables adaptive substepping for the simulation.
- CVarEnableWind: Enables or disables wind forces for anim dynamics globally.
- CVarComponentAppliedLinearAccClampOverride: Overrides the per-asset setting for linear acceleration clamping.
- CVarGravityScale: Scales the gravity effect on all Anim Dynamics Nodes.
Developers must be aware that this variable has a significant impact on performance and visual fidelity. Disabling it (setting to 0) will completely turn off anim dynamics updates, which can improve performance but at the cost of less realistic animations.
Best practices when using this variable include:
- Use it in conjunction with LOD settings to balance performance and visual quality.
- Consider enabling it only for important characters or objects close to the camera.
- Test thoroughly with different values to find the right balance between performance and animation quality for your specific game.
Regarding the associated variable CVarEnableDynamics:
The purpose of CVarEnableDynamics is the same as p.AnimDynamics. It’s an internal representation of the console variable within the C++ code.
This variable is used directly in the AnimDynamics system to check if the feature is enabled. It’s referenced in several key functions such as IsAnimDynamicsSystemEnabledFor
, HasPreUpdate
, and PreUpdate
.
The value of CVarEnableDynamics is set by the console variable p.AnimDynamics.
Developers should be aware that changing p.AnimDynamics will directly affect the behavior of CVarEnableDynamics. When writing code that interacts with the AnimDynamics system, they should use CVarEnableDynamics.GetValueOnAnyThread() to check if the system is enabled.
Best practices for using CVarEnableDynamics include:
- Always check its value before performing expensive AnimDynamics calculations.
- Use it in conjunction with other AnimDynamics settings for fine-grained control over the system’s behavior.
- Consider caching its value if checking frequently, as GetValueOnAnyThread() might have some overhead.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:121, section: [IOS_Mid DeviceProfile]
- INI Section:
IOS_Mid DeviceProfile
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:534, section: [Android_Mid DeviceProfile]
- INI Section:
Android_Mid DeviceProfile
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:20
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarRestrictLod(TEXT("p.AnimDynamicsRestrictLOD"), -1, TEXT("Forces anim dynamics to be enabled for only a specified LOD, -1 to enable on all LODs."));
TAutoConsoleVariable<int32> CVarLODThreshold(TEXT("p.AnimDynamicsLODThreshold"), -1, TEXT("Max LOD that anim dynamics is allowed to run on. Provides a global threshold that overrides per-node the LODThreshold property. -1 means no override."), ECVF_Scalability);
TAutoConsoleVariable<int32> CVarEnableDynamics(TEXT("p.AnimDynamics"), 1, TEXT("Enables/Disables anim dynamics node updates."), ECVF_Scalability);
TAutoConsoleVariable<int32> CVarEnableAdaptiveSubstep(TEXT("p.AnimDynamicsAdaptiveSubstep"), 0, TEXT("Enables/disables adaptive substepping. Adaptive substepping will substep the simulation when it is necessary and maintain a debt buffer for time, always trying to utilise as much time as possible."));
TAutoConsoleVariable<int32> CVarAdaptiveSubstepNumDebtFrames(TEXT("p.AnimDynamicsNumDebtFrames"), 5, TEXT("Number of frames to maintain as time debt when using adaptive substepping, this should be at least 1 or the time debt will never be cleared."));
TAutoConsoleVariable<int32> CVarEnableWind(TEXT("p.AnimDynamicsWind"), 1, TEXT("Enables/Disables anim dynamics wind forces globally."), ECVF_Scalability);
TAutoConsoleVariable<float> CVarComponentAppliedLinearAccClampOverride(TEXT("p.AnimDynamics.ComponentAppliedLinearAccClampOverride"), -1.0f, TEXT("Override the per asset setting for all axis (X,Y & Z) of ComponentAppliedLinearAccClamp for all Anim Dynamics Nodes. Negative values are ignored."));
TAutoConsoleVariable<float> CVarGravityScale(TEXT("p.AnimDynamics.GravityScale"), 1.0f, TEXT("Multiplies the defalut gravity and the gravity override on all Anim Dynamics Nodes."));
#Associated Variable and Callsites
This variable is associated with another variable named CVarEnableDynamics
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:20
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarRestrictLod(TEXT("p.AnimDynamicsRestrictLOD"), -1, TEXT("Forces anim dynamics to be enabled for only a specified LOD, -1 to enable on all LODs."));
TAutoConsoleVariable<int32> CVarLODThreshold(TEXT("p.AnimDynamicsLODThreshold"), -1, TEXT("Max LOD that anim dynamics is allowed to run on. Provides a global threshold that overrides per-node the LODThreshold property. -1 means no override."), ECVF_Scalability);
TAutoConsoleVariable<int32> CVarEnableDynamics(TEXT("p.AnimDynamics"), 1, TEXT("Enables/Disables anim dynamics node updates."), ECVF_Scalability);
TAutoConsoleVariable<int32> CVarEnableAdaptiveSubstep(TEXT("p.AnimDynamicsAdaptiveSubstep"), 0, TEXT("Enables/disables adaptive substepping. Adaptive substepping will substep the simulation when it is necessary and maintain a debt buffer for time, always trying to utilise as much time as possible."));
TAutoConsoleVariable<int32> CVarAdaptiveSubstepNumDebtFrames(TEXT("p.AnimDynamicsNumDebtFrames"), 5, TEXT("Number of frames to maintain as time debt when using adaptive substepping, this should be at least 1 or the time debt will never be cleared."));
TAutoConsoleVariable<int32> CVarEnableWind(TEXT("p.AnimDynamicsWind"), 1, TEXT("Enables/Disables anim dynamics wind forces globally."), ECVF_Scalability);
TAutoConsoleVariable<float> CVarComponentAppliedLinearAccClampOverride(TEXT("p.AnimDynamics.ComponentAppliedLinearAccClampOverride"), -1.0f, TEXT("Override the per asset setting for all axis (X,Y & Z) of ComponentAppliedLinearAccClamp for all Anim Dynamics Nodes. Negative values are ignored."));
TAutoConsoleVariable<float> CVarGravityScale(TEXT("p.AnimDynamics.GravityScale"), 1.0f, TEXT("Multiplies the defalut gravity and the gravity override on all Anim Dynamics Nodes."));
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:258
Scope (from outer to inner):
file
function bool FAnimNode_AnimDynamics::IsAnimDynamicsSystemEnabledFor
Source code excerpt:
// note this doesn't check LODThreshold of global value here. That's checked in
// GetLODThreshold per node
return (CVarEnableDynamics.GetValueOnAnyThread() == 1 && bEnabledForLod);
}
void FAnimNode_AnimDynamics::EvaluateSkeletalControl_AnyThread(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms)
{
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(EvaluateSkeletalControl_AnyThread)
SCOPE_CYCLE_COUNTER(STAT_AnimDynamicsOverall);
CSV_SCOPED_TIMING_STAT(Animation, AnimDynamicsEval);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:1031
Scope (from outer to inner):
file
function bool FAnimNode_AnimDynamics::HasPreUpdate
Source code excerpt:
bool FAnimNode_AnimDynamics::HasPreUpdate() const
{
if(CVarEnableDynamics.GetValueOnAnyThread() == 1)
{
return (CVarEnableWind.GetValueOnAnyThread() == 1 && (bEnableWind || bWindWasEnabled))
#if ENABLE_ANIM_DRAW_DEBUG
|| (CVarShowDebug.GetValueOnAnyThread() == 1 && !CVarDebugBone.GetValueOnAnyThread().IsEmpty())
#endif
;
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:1046
Scope (from outer to inner):
file
function void FAnimNode_AnimDynamics::PreUpdate
Source code excerpt:
{
// If dynamics are disabled, skip all this work as it'll never get used
if(CVarEnableDynamics.GetValueOnAnyThread() == 0)
{
return;
}
if(!InAnimInstance)
{
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_AnimDynamics.h:16
Scope: file
Source code excerpt:
class USkeletalMeshComponent;
extern TAutoConsoleVariable<int32> CVarEnableDynamics;
extern ANIMGRAPHRUNTIME_API TAutoConsoleVariable<int32> CVarLODThreshold;
extern TAutoConsoleVariable<int32> CVarEnableWind;
#if ENABLE_ANIM_DRAW_DEBUG
extern TAutoConsoleVariable<int32> CVarShowDebug;