p.RigidBodyNode.ComponentLinearAccScale
p.RigidBodyNode.ComponentLinearAccScale
#Overview
name: p.RigidBodyNode.ComponentLinearAccScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
ComponentLinearAccScale override
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.ComponentLinearAccScale is to control the scaling of linear acceleration in the Rigid Body Animation Node (RBAN) within Unreal Engine’s animation system. This setting variable is used to fine-tune the physics simulation of rigid bodies in skeletal animations.
This setting variable is primarily used in the AnimGraphRuntime module, specifically within the Rigid Body Animation Node system. It’s part of the bone controllers that handle physics-based animations.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of -1.0f and can be overridden at runtime using the console command system.
The p.RigidBodyNode.ComponentLinearAccScale interacts closely with other variables in the RBAN system, such as ComponentLinearVelScale and ComponentAppliedLinearAccClamp. These variables work together to control different aspects of the rigid body simulation.
Developers must be aware that this variable acts as an override. When its value is greater than or equal to 0, it overrides the ComponentLinearAccScale value set in the animation blueprint. If it’s less than 0, the blueprint value is used instead.
Best practices when using this variable include:
- Use it for fine-tuning physics behavior when default settings don’t provide desired results.
- Be cautious when changing its value, as it can significantly impact the behavior of rigid body animations.
- Consider using it in conjunction with other RBAN settings for a comprehensive adjustment of physics simulation.
Regarding the associated variable RBAN_Override_ComponentLinearAccScale:
This is the actual float variable that stores the value set by the p.RigidBodyNode.ComponentLinearAccScale console variable. It’s used internally within the AnimNode_RigidBody implementation to apply the override when necessary.
The purpose of RBAN_Override_ComponentLinearAccScale is to provide a way to globally override the ComponentLinearAccScale for all Rigid Body Animation Nodes in the game.
This variable is set directly by the console variable system and is checked in the EvaluateSkeletalControl_AnyThread function of the FAnimNode_RigidBody class.
Developers should be aware that changing RBAN_Override_ComponentLinearAccScale will affect all RBANs in the game, which can be useful for global adjustments but should be used carefully to avoid unintended consequences.
Best practices for RBAN_Override_ComponentLinearAccScale include:
- Use it for debugging or quick global adjustments during development.
- Consider exposing it as a user-configurable setting if global control over rigid body acceleration is desired in the final product.
- Remember to reset it to its default value (-1.0f) when specific overrides are no longer needed.
#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:84
Scope: file
Source code excerpt:
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;
#Associated Variable and Callsites
This variable is associated with another variable named RBAN_Override_ComponentLinearAccScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:81
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarRigidBodyNodeSpaceMaxCompLinAcc(TEXT("p.RigidBodyNode.Space.MaxLinearAcceleration"), RBAN_SimSpaceOverride_MaxLinearAcceleration, TEXT("RBAN SimSpaceSettings overrides"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeSpaceMaxCompAngAcc(TEXT("p.RigidBodyNode.Space.MaxAngularAcceleration"), RBAN_SimSpaceOverride_MaxAngularAcceleration, TEXT("RBAN SimSpaceSettings overrides"), ECVF_Default);
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;
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:731
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();