p.RigidBodyNode.WorldObjectExpiry
p.RigidBodyNode.WorldObjectExpiry
#Overview
name: p.RigidBodyNode.WorldObjectExpiry
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
World objects are removed from the simulation if not detected after this many tests
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.WorldObjectExpiry is to control the expiration of world objects in the rigid body simulation system within Unreal Engine’s animation runtime.
This setting variable is primarily used in the AnimGraphRuntime module, specifically within the rigid body animation node system. It’s part of the physics simulation for animated characters, helping to manage the lifecycle of objects in the world that interact with the rigid body simulation.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. It’s initialized with a default value of 4, as seen in the associated variable RBAN_WorldObjectExpiry.
The main variable that interacts with it is RBAN_WorldObjectExpiry, which shares the same value. This variable is used directly in the ExpireWorldObjects function of the FAnimNode_RigidBody class to determine when to remove world objects from the simulation.
Developers must be aware that this variable affects the performance and behavior of rigid body simulations in animations. A lower value will cause world objects to be removed from the simulation more quickly if they’re not detected, which can improve performance but might lead to less accurate simulations if objects are prematurely removed.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your game. If you have a lot of dynamic objects interacting with animated characters, you might want to increase this value for more persistent simulations.
- Using it in conjunction with other rigid body simulation settings for optimal performance and accuracy.
- Testing different values to find the right balance between simulation accuracy and performance for your specific use case.
Regarding the associated variable RBAN_WorldObjectExpiry:
The purpose of RBAN_WorldObjectExpiry is to store the actual value used in the rigid body simulation code. It’s the internal representation of the console variable p.RigidBodyNode.WorldObjectExpiry.
This variable is used directly in the AnimGraphRuntime module, specifically in the FAnimNode_RigidBody::ExpireWorldObjects function. It determines how many simulation ticks an object can go without being detected before it’s removed from the simulation.
The value of RBAN_WorldObjectExpiry is set through the console variable system, allowing for runtime adjustment.
It primarily interacts with the ComponentsInSimTick and LastSeenTick variables within the world object tracking system of the rigid body simulation.
Developers should be aware that modifying this variable directly in code won’t have the desired effect, as it’s controlled by the console variable system. Always use the console variable p.RigidBodyNode.WorldObjectExpiry to adjust this setting.
Best practices for RBAN_WorldObjectExpiry are similar to those for p.RigidBodyNode.WorldObjectExpiry, focusing on finding the right balance between simulation persistence and performance for your specific game requirements.
#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:61
Scope: file
Source code excerpt:
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);
// FSimSpaceSettings forced overrides for testing
bool bRBAN_SimSpace_EnableOverride = false;
#Associated Variable and Callsites
This variable is associated with another variable named RBAN_WorldObjectExpiry
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:57
Scope: file
Source code excerpt:
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);
// FSimSpaceSettings forced overrides for testing
bool bRBAN_SimSpace_EnableOverride = false;
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:1717
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::ExpireWorldObjects
Source code excerpt:
// Do we need to expire this object?
const int32 ExpireTickCount = RBAN_WorldObjectExpiry;
bool bIsInvalid =
((ComponentsInSimTick - WorldObject.LastSeenTick) > ExpireTickCount) // Haven't seen this object for a while
|| !IsValid(WorldComp)
|| (WorldComp->GetBodyInstance() == nullptr)
|| (!WorldComp->GetBodyInstance()->IsValidBodyInstance());