p.RigidBodyNode.MaxSubSteps
p.RigidBodyNode.MaxSubSteps
#Overview
name: p.RigidBodyNode.MaxSubSteps
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set the maximum number of simulation steps in the update loop
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.MaxSubSteps is to set the maximum number of simulation steps in the update loop for the rigid body simulation in Unreal Engine’s animation system.
This setting variable is primarily used in the animation system, specifically in the Rigid Body Node functionality. It’s part of the AnimGraphRuntime module, which is responsible for handling complex animation graph operations.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 4 and can be changed at runtime using console commands or through configuration files.
The associated variable RBAN_MaxSubSteps directly interacts with p.RigidBodyNode.MaxSubSteps. They share the same value, with RBAN_MaxSubSteps being the actual variable used in the code logic.
Developers must be aware that this variable directly affects the physics simulation performance and accuracy. A higher value will result in more accurate simulations but at the cost of increased computational load.
Best practices when using this variable include:
- Balancing between simulation accuracy and performance based on the specific needs of the game or application.
- Testing different values to find the optimal setting for your particular use case.
- Consider adjusting this value dynamically based on the current performance requirements or scene complexity.
Regarding the associated variable RBAN_MaxSubSteps:
- It’s used directly in the physics simulation logic within the FAnimNode_RigidBody::RunPhysicsSimulation function.
- It determines the maximum number of steps the physics simulation can take in a single update, helping to maintain stability in the simulation.
- Developers should be cautious about setting this value too high, as it could lead to performance issues in complex scenes or on less powerful hardware.
- It’s important to note that this variable is used in conjunction with a fixed maximum delta time (1/30th of a second), which helps ensure consistent behavior across different frame rates.
#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:58
Scope: file
Source code excerpt:
bool bRBAN_EnableComponentAcceleration = true;
int32 RBAN_WorldObjectExpiry = 4;
FAutoConsoleVariableRef CVarRigidBodyNodeMaxSteps(TEXT("p.RigidBodyNode.MaxSubSteps"), RBAN_MaxSubSteps, TEXT("Set the maximum number of simulation steps in the update loop"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableTimeBasedReset(TEXT("p.RigidBodyNode.EnableTimeBasedReset"), bRBAN_EnableTimeBasedReset, TEXT("If true, Rigid Body nodes are reset when they have not been updated for a while (default true)"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableComponentAcceleration(TEXT("p.RigidBodyNode.EnableComponentAcceleration"), bRBAN_EnableComponentAcceleration, TEXT("Enable/Disable the simple acceleration transfer system for component- or bone-space simulation"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeWorldObjectExpiry(TEXT("p.RigidBodyNode.WorldObjectExpiry"), RBAN_WorldObjectExpiry, TEXT("World objects are removed from the simulation if not detected after this many tests"), ECVF_Default);
bool bRBAN_IncludeClothColliders = true;
FAutoConsoleVariableRef CVarRigidBodyNodeIncludeClothColliders(TEXT("p.RigidBodyNode.IncludeClothColliders"), bRBAN_IncludeClothColliders, TEXT("Include cloth colliders as kinematic bodies in the immediate physics simulation."), ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named RBAN_MaxSubSteps
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:54
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarRigidBodyLODThreshold(TEXT("p.RigidBodyLODThreshold"), -1, TEXT("Max LOD that rigid body node is allowed to run on. Provides a global threshold that overrides per-node the LODThreshold property. -1 means no override."), ECVF_Scalability);
int32 RBAN_MaxSubSteps = 4;
bool bRBAN_EnableTimeBasedReset = true;
bool bRBAN_EnableComponentAcceleration = true;
int32 RBAN_WorldObjectExpiry = 4;
FAutoConsoleVariableRef CVarRigidBodyNodeMaxSteps(TEXT("p.RigidBodyNode.MaxSubSteps"), RBAN_MaxSubSteps, TEXT("Set the maximum number of simulation steps in the update loop"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableTimeBasedReset(TEXT("p.RigidBodyNode.EnableTimeBasedReset"), bRBAN_EnableTimeBasedReset, TEXT("If true, Rigid Body nodes are reset when they have not been updated for a while (default true)"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeEnableComponentAcceleration(TEXT("p.RigidBodyNode.EnableComponentAcceleration"), bRBAN_EnableComponentAcceleration, TEXT("Enable/Disable the simple acceleration transfer system for component- or bone-space simulation"), ECVF_Default);
FAutoConsoleVariableRef CVarRigidBodyNodeWorldObjectExpiry(TEXT("p.RigidBodyNode.WorldObjectExpiry"), RBAN_WorldObjectExpiry, TEXT("World objects are removed from the simulation if not detected after this many tests"), ECVF_Default);
bool bRBAN_IncludeClothColliders = true;
FAutoConsoleVariableRef CVarRigidBodyNodeIncludeClothColliders(TEXT("p.RigidBodyNode.IncludeClothColliders"), bRBAN_IncludeClothColliders, TEXT("Include cloth colliders as kinematic bodies in the immediate physics simulation."), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:492
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::RunPhysicsSimulation
Source code excerpt:
FScopeCycleCounterUObject AdditionalScope(UsePhysicsAsset, GET_STATID(STAT_RigidBodyNode_Simulation));
const int32 MaxSteps = RBAN_MaxSubSteps;
const float MaxDeltaSeconds = 1.f / 30.f;
PhysicsSimulation->Simulate_AssumesLocked(DeltaSeconds, MaxDeltaSeconds, MaxSteps, SimSpaceGravity);
}
void FAnimNode_RigidBody::FlushDeferredSimulationTask()