p.RigidBodyNode.TaskPriority.Simulation
p.RigidBodyNode.TaskPriority.Simulation
#Overview
name: p.RigidBodyNode.TaskPriority.Simulation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Task priority for running the rigid body node simulation task (0 = foreground/high, 1 = foreground/normal, 2 = background/high, 3 = background/normal, 4 = background/low).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.RigidBodyNode.TaskPriority.Simulation is to control the task priority for running the rigid body node simulation task in Unreal Engine 5’s animation system.
This setting variable is primarily used in the Animation Graph Runtime module, specifically within the Rigid Body Node simulation system. It’s part of the bone controllers subsystem, which is responsible for manipulating skeletal meshes and their animations.
The value of this variable is set through the Unreal Engine console variable system. It’s defined using FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The associated variable GRigidBodyNodeSimulationTaskPriority directly interacts with p.RigidBodyNode.TaskPriority.Simulation. They share the same value, with GRigidBodyNodeSimulationTaskPriority being the actual integer storage for the priority level.
Developers must be aware that this variable affects the scheduling priority of the rigid body simulation tasks. The priority levels range from 0 to 4, with 0 being the highest priority (foreground/high) and 4 being the lowest (background/low).
Best practices when using this variable include:
- Carefully consider the impact on overall performance when adjusting the priority.
- Use higher priorities (0 or 1) for critical animations that need immediate updates.
- Use lower priorities (2, 3, or 4) for less critical background simulations to balance system resources.
- Monitor performance metrics when adjusting this value to ensure optimal resource utilization.
Regarding the associated variable GRigidBodyNodeSimulationTaskPriority:
The purpose of GRigidBodyNodeSimulationTaskPriority is to store the actual integer value of the task priority for rigid body node simulation.
This variable is used within the Animation Graph Runtime module, specifically in the AnimNode_RigidBody implementation.
The value of GRigidBodyNodeSimulationTaskPriority is set through the console variable system, mirroring p.RigidBodyNode.TaskPriority.Simulation.
It directly interacts with p.RigidBodyNode.TaskPriority.Simulation and is used in the task scheduling logic for rigid body simulations.
Developers should be aware that modifying GRigidBodyNodeSimulationTaskPriority directly in code is not recommended, as it’s meant to be controlled via the console variable system.
Best practices include using the console variable p.RigidBodyNode.TaskPriority.Simulation to modify this value rather than changing it directly in code, ensuring consistent behavior across the engine.
#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:120
Scope: file
Source code excerpt:
static int32 GRigidBodyNodeSimulationTaskPriority = 0;
FAutoConsoleVariableRef CVarRigidBodyNodeSimulationTaskPriority(
TEXT("p.RigidBodyNode.TaskPriority.Simulation"),
GRigidBodyNodeSimulationTaskPriority,
TEXT("Task priority for running the rigid body node simulation task (0 = foreground/high, 1 = foreground/normal, 2 = background/high, 3 = background/normal, 4 = background/low)."),
ECVF_Default
);
// This is to validate our declaration of TIsPODType in the header, which
#Associated Variable and Callsites
This variable is associated with another variable named GRigidBodyNodeSimulationTaskPriority
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:118
Scope: file
Source code excerpt:
};
static int32 GRigidBodyNodeSimulationTaskPriority = 0;
FAutoConsoleVariableRef CVarRigidBodyNodeSimulationTaskPriority(
TEXT("p.RigidBodyNode.TaskPriority.Simulation"),
GRigidBodyNodeSimulationTaskPriority,
TEXT("Task priority for running the rigid body node simulation task (0 = foreground/high, 1 = foreground/normal, 2 = background/high, 3 = background/normal, 4 = background/low)."),
ECVF_Default
);
// This is to validate our declaration of TIsPODType in the header, which
// was done to ensure that STRUCT_IsPlainOldData is set, which allows scripts
#Loc: <Workspace>/Engine/Source/Runtime/AnimGraphRuntime/Private/BoneControllers/AnimNode_RigidBody.cpp:929
Scope (from outer to inner):
file
function void FAnimNode_RigidBody::EvaluateSkeletalControl_AnyThread
Source code excerpt:
// FlushDeferredSimulationTask() should have already ensured task is done.
ensure(SimulationTask.IsCompleted());
const int32 PriorityIndex = FMath::Clamp<int32>(GRigidBodyNodeSimulationTaskPriority, 0, UE_ARRAY_COUNT(GRigidBodyNodeTaskPriorities) - 1);
const UE::Tasks::ETaskPriority TaskPriority = GRigidBodyNodeTaskPriorities[PriorityIndex];
SimulationTask = UE::Tasks::Launch(
TEXT("RigidBodyNodeSimulationTask"),
[this, DeltaSeconds, SimSpaceGravity] { RunPhysicsSimulation(DeltaSeconds, SimSpaceGravity); },
TaskPriority);
}