p.AnimDynamicsWind

p.AnimDynamicsWind

#Overview

name: p.AnimDynamicsWind

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.AnimDynamicsWind is to enable or disable wind forces globally for the animation dynamics system in Unreal Engine 5. This setting variable is primarily used for the animation system, specifically for the AnimDynamics feature.

The Unreal Engine subsystem that relies on this setting variable is the AnimGraphRuntime module, which is part of the animation system. This can be seen from the file path where the variable is defined and used: “Engine/Source/Runtime/AnimGraphRuntime/”.

The value of this variable is set as a console variable (CVar) with an initial value of 1 (enabled). It can be changed at runtime through the console or programmatically.

This variable interacts with other variables in the AnimDynamics system, such as CVarEnableDynamics and bEnableWind. It’s used in conjunction with these variables to determine whether wind forces should be applied to the animation dynamics.

Developers must be aware that this is a global setting that affects all AnimDynamics nodes in the project. Disabling this variable will turn off wind forces for all AnimDynamics, regardless of individual node settings.

Best practices when using this variable include:

  1. Use it for performance optimization by disabling wind forces when not needed.
  2. Consider using it in conjunction with scalability settings, as it’s defined with ECVF_Scalability flag.
  3. Be cautious when changing this value at runtime, as it might cause sudden changes in animation behavior.

Regarding the associated variable CVarEnableWind:

The purpose of CVarEnableWind is the same as p.AnimDynamicsWind. It’s an internal representation of the console variable used in the C++ code.

This variable is used directly in the AnimGraphRuntime module to check if wind forces should be applied. It’s checked in the PreUpdate function of the FAnimNode_AnimDynamics class to determine if wind data should be processed.

The value of CVarEnableWind is set by the console variable system when p.AnimDynamicsWind is changed.

CVarEnableWind interacts with other variables like CVarEnableDynamics and bEnableWind to control the behavior of the AnimDynamics system.

Developers should be aware that this is the actual variable used in the code, so any runtime checks or modifications should use CVarEnableWind rather than p.AnimDynamicsWind directly.

Best practices for CVarEnableWind are similar to those for p.AnimDynamicsWind, as they represent the same setting. However, when accessing this value in C++ code, developers should use the GetValueOnAnyThread() method to ensure thread-safe access.

#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:23

Scope: file

Source code excerpt:

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."));

// FindChainBones
// 
// Returns an ordered list of the names of all the bones in a chain between BeginBoneName and EndBoneName.

#Associated Variable and Callsites

This variable is associated with another variable named CVarEnableWind. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:23

Scope: file

Source code excerpt:

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."));

// FindChainBones
// 
// Returns an ordered list of the names of all the bones in a chain between BeginBoneName and EndBoneName.

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_AnimDynamics.cpp:1033

Scope (from outer to inner):

file
function     bool FAnimNode_AnimDynamics::HasPreUpdate

Source code excerpt:

	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:1067

Scope (from outer to inner):

file
function     void FAnimNode_AnimDynamics::PreUpdate

Source code excerpt:

	const UWorld* World = SkelComp->GetWorld();

	if(CVarEnableWind.GetValueOnAnyThread() == 1 && bEnableWind)
	{
		CONDITIONAL_SCOPE_CYCLE_COUNTER(STAT_AnimDynamicsWindData, FAnimPhys::bEnableDetailedStats);

		for(FAnimPhysRigidBody* Body : BaseBodyPtrs)
		{
			Body->bWindEnabled = bEnableWind;

#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_AnimDynamics.h:18

Scope: file

Source code excerpt:

extern TAutoConsoleVariable<int32> CVarEnableDynamics;
extern ANIMGRAPHRUNTIME_API TAutoConsoleVariable<int32> CVarLODThreshold;
extern TAutoConsoleVariable<int32> CVarEnableWind;

#if ENABLE_ANIM_DRAW_DEBUG

extern TAutoConsoleVariable<int32> CVarShowDebug;
extern TAutoConsoleVariable<FString> CVarDebugBone;