p.Chaos.ImmPhys.NumSteps
p.Chaos.ImmPhys.NumSteps
#Overview
name: p.Chaos.ImmPhys.NumSteps
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override num steps (if not zero)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.ImmPhys.NumSteps is to override the number of steps in the Chaos Immediate Physics simulation. This setting variable is part of the physics system in Unreal Engine 5, specifically for the Chaos physics engine’s immediate mode.
The Unreal Engine subsystem that relies on this setting variable is the physics engine, particularly the Chaos physics engine’s immediate physics simulation module. This can be seen from the file path where the variable is referenced: Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.
This variable interacts with ChaosImmediate_Evolution_NumSteps, which is the actual internal variable that stores the value. The console variable p.Chaos.ImmPhys.NumSteps is used to set and modify ChaosImmediate_Evolution_NumSteps.
Developers must be aware that this variable only takes effect if its value is greater than zero. If it’s zero or negative, the simulation will use its default or calculated number of steps.
Best practices when using this variable include:
- Only modify it if you need to override the default behavior of the physics simulation.
- Be cautious when increasing the number of steps, as it can significantly impact performance.
- Use it in conjunction with other physics settings to achieve the desired balance between accuracy and performance.
Regarding the associated variable ChaosImmediate_Evolution_NumSteps:
The purpose of ChaosImmediate_Evolution_NumSteps is to store the actual number of steps used in the Chaos Immediate Physics simulation. It’s the internal representation of the p.Chaos.ImmPhys.NumSteps console variable.
This variable is used directly in the physics simulation code. As seen in the provided code excerpt, it’s checked in the Simulate function of the FSimulation class within the ImmediatePhysics_Chaos namespace.
The value of this variable is set either through the associated console variable p.Chaos.ImmPhys.NumSteps or through internal calculations in the physics simulation.
ChaosImmediate_Evolution_NumSteps interacts closely with other simulation parameters, such as ChaosImmediate_Evolution_StepTime, to control the behavior of the physics simulation.
Developers should be aware that this variable directly affects the physics simulation’s behavior and performance. Modifying it can have significant impacts on both the accuracy and the computational cost of the simulation.
Best practices for using this variable include:
- Avoid modifying it directly in code; instead, use the console variable p.Chaos.ImmPhys.NumSteps to change its value.
- Monitor its value during performance profiling to understand its impact on simulation performance.
- Consider its interaction with other physics parameters when tuning the simulation behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:44
Scope: file
Source code excerpt:
int32 ChaosImmediate_Evolution_NumCollisionsPerBlock = 50;
FAutoConsoleVariableRef CVarChaosImmPhysStepTime(TEXT("p.Chaos.ImmPhys.StepTime"), ChaosImmediate_Evolution_StepTime, TEXT("Override step time (if not zero)"));
FAutoConsoleVariableRef CVarChaosImmPhysNumSteps(TEXT("p.Chaos.ImmPhys.NumSteps"), ChaosImmediate_Evolution_NumSteps, TEXT("Override num steps (if not zero)"));
FAutoConsoleVariableRef CVarChaosImmPhysInitialStepTime(TEXT("p.Chaos.ImmPhys.InitialStepTime"), ChaosImmediate_Evolution_InitialStepTime, TEXT("Initial step time (then calculated from rolling average)"));
FAutoConsoleVariableRef CVarChaosImmPhysDeltaTimeCount(TEXT("p.Chaos.ImmPhys.DeltaTimeCount"), ChaosImmediate_Evolution_DeltaTimeCount, TEXT("The number of ticks over which the moving average is calculated"));
FAutoConsoleVariableRef CVarChaosImmPhysPositionIterations(TEXT("p.Chaos.ImmPhys.PositionIterations"), ChaosImmediate_Evolution_PositionIterations, TEXT("Override number of position iteration loops in immediate physics (if >= 0)"));
FAutoConsoleVariableRef CVarChaosImmPhysVelocityIterations(TEXT("p.Chaos.ImmPhys.VelocityIterations"), ChaosImmediate_Evolution_VelocityIterations, TEXT("Override number of velocity iteration loops in immediate physics (if >= 0)"));
FAutoConsoleVariableRef CVarChaosImmPhysProjectionIterations(TEXT("p.Chaos.ImmPhys.ProjectionIterations"), ChaosImmediate_Evolution_ProjectionIterations, TEXT("Override number of projection iteration loops in immediate physics (if >= 0)"));
FAutoConsoleVariableRef CVarChaosImmPhysDisableInactiveByIndex(TEXT("p.Chaos.ImmPhys.DisableInactiveByIndex"), ChaosImmediate_DisableInactiveByIndex, TEXT("Disable bodies that are no longer active based on the index, rather than just count."));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosImmediate_Evolution_NumSteps
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:35
Scope: file
Source code excerpt:
//
Chaos::FRealSingle ChaosImmediate_Evolution_StepTime = 0.0f;
int32 ChaosImmediate_Evolution_NumSteps = 0;
Chaos::FRealSingle ChaosImmediate_Evolution_InitialStepTime = 0.033f;
int32 ChaosImmediate_Evolution_DeltaTimeCount = 100;
int32 ChaosImmediate_Evolution_PositionIterations = -1;
int32 ChaosImmediate_Evolution_VelocityIterations = -1;
int32 ChaosImmediate_Evolution_ProjectionIterations = -1;
int32 ChaosImmediate_DisableInactiveByIndex = 1;
int32 ChaosImmediate_Evolution_NumCollisionsPerBlock = 50;
FAutoConsoleVariableRef CVarChaosImmPhysStepTime(TEXT("p.Chaos.ImmPhys.StepTime"), ChaosImmediate_Evolution_StepTime, TEXT("Override step time (if not zero)"));
FAutoConsoleVariableRef CVarChaosImmPhysNumSteps(TEXT("p.Chaos.ImmPhys.NumSteps"), ChaosImmediate_Evolution_NumSteps, TEXT("Override num steps (if not zero)"));
FAutoConsoleVariableRef CVarChaosImmPhysInitialStepTime(TEXT("p.Chaos.ImmPhys.InitialStepTime"), ChaosImmediate_Evolution_InitialStepTime, TEXT("Initial step time (then calculated from rolling average)"));
FAutoConsoleVariableRef CVarChaosImmPhysDeltaTimeCount(TEXT("p.Chaos.ImmPhys.DeltaTimeCount"), ChaosImmediate_Evolution_DeltaTimeCount, TEXT("The number of ticks over which the moving average is calculated"));
FAutoConsoleVariableRef CVarChaosImmPhysPositionIterations(TEXT("p.Chaos.ImmPhys.PositionIterations"), ChaosImmediate_Evolution_PositionIterations, TEXT("Override number of position iteration loops in immediate physics (if >= 0)"));
FAutoConsoleVariableRef CVarChaosImmPhysVelocityIterations(TEXT("p.Chaos.ImmPhys.VelocityIterations"), ChaosImmediate_Evolution_VelocityIterations, TEXT("Override number of velocity iteration loops in immediate physics (if >= 0)"));
FAutoConsoleVariableRef CVarChaosImmPhysProjectionIterations(TEXT("p.Chaos.ImmPhys.ProjectionIterations"), ChaosImmediate_Evolution_ProjectionIterations, TEXT("Override number of projection iteration loops in immediate physics (if >= 0)"));
FAutoConsoleVariableRef CVarChaosImmPhysDisableInactiveByIndex(TEXT("p.Chaos.ImmPhys.DisableInactiveByIndex"), ChaosImmediate_DisableInactiveByIndex, TEXT("Disable bodies that are no longer active based on the index, rather than just count."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:920
Scope (from outer to inner):
file
namespace ImmediatePhysics_Chaos
function void FSimulation::Simulate
Source code excerpt:
StepTime = ChaosImmediate_Evolution_StepTime;
}
if (ChaosImmediate_Evolution_NumSteps > 0)
{
NumSteps = ChaosImmediate_Evolution_NumSteps;
}
}
// Fixed timestep mode DT (Only used if > 0.0f)
FReal FixedStepTime = Implementation->FixedStepTime;