p.RigidBodyNode.DeferredSimulationDefault
p.RigidBodyNode.DeferredSimulationDefault
#Overview
name: p.RigidBodyNode.DeferredSimulationDefault
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether rigid body simulations are deferred one frame for assets that don\'t opt into a specific simulation timing
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.DeferredSimulationDefault is to control the default behavior of rigid body simulations in the animation system of Unreal Engine 5. Specifically, it determines whether rigid body simulations are deferred by one frame for assets that don’t specify a particular simulation timing.
This setting variable is primarily used by the animation system, particularly in the rigid body animation node (RBAN) within the AnimGraphRuntime module. It affects how the engine handles the timing of rigid body physics simulations in character animations.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as a boolean value, with false being the default, meaning simulations are not deferred by default.
This variable interacts closely with two other variables:
- bRBAN_DeferredSimulationDefault, which directly shares its value.
- bRBAN_DeferredSimulationForceDefault, which can force the use of the DeferredSimulationDefault value, ignoring individual node settings.
Developers must be aware that this setting affects performance and visual results. Deferring simulations can improve performance by spreading the computational load across frames, but it may introduce a slight delay in physics responses.
Best practices when using this variable include:
- Consider the performance vs. responsiveness trade-off for your specific use case.
- Use in conjunction with the SimulationTiming enum in individual AnimNode_RigidBody instances for fine-grained control.
- Be aware of the bRBAN_DeferredSimulationForceDefault variable, which can override individual node settings.
Regarding the associated variable bRBAN_DeferredSimulationDefault:
This is the actual boolean variable that stores the value set by p.RigidBodyNode.DeferredSimulationDefault. It’s used directly in the code to determine the simulation timing behavior.
The purpose of bRBAN_DeferredSimulationDefault is to provide a runtime-accessible boolean value that reflects the console variable setting.
It’s used within the AnimGraphRuntime module, specifically in the FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread function to determine whether to use deferred simulation.
The value is set by the console variable system when p.RigidBodyNode.DeferredSimulationDefault is modified.
This variable interacts with the SimulationTiming enum and bRBAN_DeferredSimulationForceDefault to determine the final simulation timing behavior.
Developers should be aware that modifying p.RigidBodyNode.DeferredSimulationDefault will directly affect this variable’s value.
Best practices include using this variable for runtime checks of the deferred simulation setting, rather than directly accessing the console variable in performance-critical code paths.
#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:92
Scope: file
Source code excerpt:
bool bRBAN_DeferredSimulationDefault = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDeferredSimulationDefault(
TEXT("p.RigidBodyNode.DeferredSimulationDefault"),
bRBAN_DeferredSimulationDefault,
TEXT("Whether rigid body simulations are deferred one frame for assets that don't opt into a specific simulation timing"),
ECVF_Default);
bool bRBAN_DeferredSimulationForceDefault = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDeferredSimulationForceDefault(TEXT("p.RigidBodyNode.DeferredSimulationForceDefault"), bRBAN_DeferredSimulationForceDefault, TEXT("When true, rigid body simulation will always use the value of p.RigidBodyNode.DeferredSimulationDefault to determine whether to defer the simulation work, ignoring the setting in the individual node."), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_RigidBody.h:35
Scope: file
Source code excerpt:
enum class ESimulationTiming : uint8
{
/** Use the default project setting as defined by p.RigidBodyNode.DeferredSimulationDefault. */
Default,
/** Always run the simulation to completion during animation evaluation. */
Synchronous,
/** Always run the simulation in the background and retrieve the result on the next animation evaluation. */
Deferred
};
#Associated Variable and Callsites
This variable is associated with another variable named bRBAN_DeferredSimulationDefault
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:90
Scope: file
Source code excerpt:
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"),
bRBAN_DeferredSimulationDefault,
TEXT("Whether rigid body simulations are deferred one frame for assets that don't opt into a specific simulation timing"),
ECVF_Default);
bool bRBAN_DeferredSimulationForceDefault = false;
FAutoConsoleVariableRef CVarRigidBodyNodeDeferredSimulationForceDefault(TEXT("p.RigidBodyNode.DeferredSimulationForceDefault"), bRBAN_DeferredSimulationForceDefault, TEXT("When true, rigid body simulation will always use the value of p.RigidBodyNode.DeferredSimulationDefault to determine whether to defer the simulation work, ignoring the setting in the individual node."), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:699
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread
Source code excerpt:
// Assets can override config for deferred simulation
const bool bUseDeferredSimulationTask =
((SimulationTiming == ESimulationTiming::Default) || bRBAN_DeferredSimulationForceDefault) ? bRBAN_DeferredSimulationDefault : (SimulationTiming == ESimulationTiming::Deferred);
FVector SimSpaceGravity(0.f);
// Only need to tick physics if we didn't reset and we have some time to simulate
const bool bNeedsSimulationTick = ((bSimulateAnimPhysicsAfterReset || (ResetSimulatedTeleportType != ETeleportType::ResetPhysics)) && DeltaSeconds > AnimPhysicsMinDeltaTime);
if (bNeedsSimulationTick)