p.RigidBodyNode.ComponentAppliedLinearAccClamp
p.RigidBodyNode.ComponentAppliedLinearAccClamp
#Overview
name: p.RigidBodyNode.ComponentAppliedLinearAccClamp
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
ComponentAppliedLinearAccClamp override
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.ComponentAppliedLinearAccClamp is to control the maximum applied linear acceleration in the Rigid Body Animation Node (RBAN) system within Unreal Engine’s animation framework.
This setting variable is primarily used in the animation system, specifically in the Rigid Body Animation Node module. It’s part of the AnimGraphRuntime subsystem, which handles advanced animation graph functionalities.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The p.RigidBodyNode.ComponentAppliedLinearAccClamp variable interacts closely with its associated variable RBAN_Override_ComponentAppliedLinearAccClamp. They share the same value, and RBAN_Override_ComponentAppliedLinearAccClamp is used in the actual code logic to determine whether to use the override value or the default ComponentAppliedLinearAccClamp value.
Developers must be aware that this variable acts as an override. When its value is set to -1 or lower, it doesn’t affect the system, and the default ComponentAppliedLinearAccClamp value is used instead. Any value of 0 or higher will override the default behavior.
Best practices when using this variable include:
- Use it sparingly and only when necessary to tune the rigid body simulation behavior.
- Be cautious when setting non-default values, as it may affect the realism and stability of the rigid body simulation.
- Consider the interaction with other related variables like ComponentLinearAccScale and ComponentLinearVelScale.
Regarding the associated variable RBAN_Override_ComponentAppliedLinearAccClamp:
The purpose of RBAN_Override_ComponentAppliedLinearAccClamp is to store the override value for the ComponentAppliedLinearAccClamp in the Rigid Body Animation Node system.
This variable is used directly in the animation system’s logic, specifically in the FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread function. It determines whether to use the override value or the default ComponentAppliedLinearAccClamp value.
The value of this variable is set through the console variable system, linked to the p.RigidBodyNode.ComponentAppliedLinearAccClamp console command.
It interacts closely with the ComponentAppliedLinearAccClamp member variable of the FAnimNode_RigidBody class.
Developers should be aware that this variable’s default value is -1, which means “do not override” by default. Any value of 0 or higher will cause the override to take effect.
Best practices for using this variable include:
- Use it for debugging or fine-tuning purposes, not as a primary means of controlling the simulation.
- Reset it to -1 when the override is no longer needed to ensure default behavior.
- Consider the performance implications of frequently changing this value during runtime.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:86
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarRigidBodyNodeOverrideComponentLinearAccScale(TEXT("p.RigidBodyNode.ComponentLinearAccScale"), RBAN_Override_ComponentLinearAccScale, TEXT("ComponentLinearAccScale override"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeOverrideComponentLinearVelScale(TEXT("p.RigidBodyNode.ComponentLinearVelcale"), RBAN_Override_ComponentLinearVelScale, TEXT("ComponentLinearVelcale override"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeOverrideComponentAppliedLinearAccClamp(TEXT("p.RigidBodyNode.ComponentAppliedLinearAccClamp"), RBAN_Override_ComponentAppliedLinearAccClamp, TEXT("ComponentAppliedLinearAccClamp override"), ECVF_Default);
float RBAN_GravityScale = 1.0f;
FAutoConsoleVariableRef CVarRigidBodyNodeGravityScale(TEXT("p.RigidBodyNode.GravityScale"), RBAN_GravityScale, TEXT("Multiplies the gravity on all RBANs"), ECVF_Default);
bool bRBAN_DeferredSimulationDefault = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDeferredSimulationDefault(
TEXT("p.RigidBodyNode.DeferredSimulationDefault"),
#Associated Variable and Callsites
This variable is associated with another variable named RBAN_Override_ComponentAppliedLinearAccClamp
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:83
Scope: file
Source code excerpt:
float RBAN_Override_ComponentLinearAccScale = -1.0f;
float RBAN_Override_ComponentLinearVelScale = -1.0f;
float RBAN_Override_ComponentAppliedLinearAccClamp = -1.0f;
FAutoConsoleVariableRef CVarRigidBodyNodeOverrideComponentLinearAccScale(TEXT("p.RigidBodyNode.ComponentLinearAccScale"), RBAN_Override_ComponentLinearAccScale, TEXT("ComponentLinearAccScale override"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeOverrideComponentLinearVelScale(TEXT("p.RigidBodyNode.ComponentLinearVelcale"), RBAN_Override_ComponentLinearVelScale, TEXT("ComponentLinearVelcale override"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeOverrideComponentAppliedLinearAccClamp(TEXT("p.RigidBodyNode.ComponentAppliedLinearAccClamp"), RBAN_Override_ComponentAppliedLinearAccClamp, TEXT("ComponentAppliedLinearAccClamp override"), ECVF_Default);
float RBAN_GravityScale = 1.0f;
FAutoConsoleVariableRef CVarRigidBodyNodeGravityScale(TEXT("p.RigidBodyNode.GravityScale"), RBAN_GravityScale, TEXT("Multiplies the gravity on all RBANs"), ECVF_Default);
bool bRBAN_DeferredSimulationDefault = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDeferredSimulationDefault(
TEXT("p.RigidBodyNode.DeferredSimulationDefault"),
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:732
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread
Source code excerpt:
const FVector UseComponentLinearVelScale = (RBAN_Override_ComponentLinearVelScale >= 0) ? FVector(RBAN_Override_ComponentLinearVelScale) : ComponentLinearVelScale;
const FVector UseComponentLinearAccScale = (RBAN_Override_ComponentLinearAccScale >= 0) ? FVector(RBAN_Override_ComponentLinearAccScale) : ComponentLinearAccScale;
const FVector UseComponentAppliedLinearAccClamp = (RBAN_Override_ComponentAppliedLinearAccClamp >= 0) ? FVector(RBAN_Override_ComponentAppliedLinearAccClamp) : ComponentAppliedLinearAccClamp;
if (!UseComponentLinearVelScale.IsNearlyZero() || !UseComponentLinearAccScale.IsNearlyZero())
{
// Calc linear velocity
const FVector ComponentDeltaLocation = CurrentTransform.GetTranslation() - PreviousTransform.GetTranslation();
const FVector ComponentLinearVelocity = ComponentDeltaLocation / DeltaSeconds;