p.Chaos.ImmPhys.StepTime

p.Chaos.ImmPhys.StepTime

#Overview

name: p.Chaos.ImmPhys.StepTime

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.ImmPhys.StepTime is to override the step time in the Chaos Immediate Physics simulation system. This setting variable is part of the physics engine, specifically the Chaos physics system in Unreal Engine 5.

The Unreal Engine subsystem that relies on this setting variable is the Immediate Physics simulation module within the Chaos physics system. This can be seen from the file path and the namespace in which it’s used: ImmediatePhysics_Chaos.

The value of this variable is set through the console variable system in Unreal Engine. It’s declared as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.

This variable interacts directly with ChaosImmediate_Evolution_StepTime. They share the same value, as ChaosImmediate_Evolution_StepTime is the actual variable that stores the step time, while p.Chaos.ImmPhys.StepTime is the console variable name used to modify it.

Developers must be aware that this variable overrides the default step time calculation only if its value is greater than zero. This is evident from the condition check in the Simulate function: if (ChaosImmediate_Evolution_StepTime > 0).

Best practices when using this variable include:

  1. Use it for debugging or fine-tuning physics simulations.
  2. Be cautious when modifying it, as it can significantly impact the physics simulation’s behavior and performance.
  3. Reset it to 0 (or its default value) after debugging to allow the engine to calculate the step time dynamically.

Regarding the associated variable ChaosImmediate_Evolution_StepTime:

The purpose of ChaosImmediate_Evolution_StepTime is to store the actual step time value used in the Chaos Immediate Physics simulation.

It’s used directly in the Chaos Immediate Physics simulation module, as seen in the FSimulation::Simulate function.

The value of this variable is set either through the console variable p.Chaos.ImmPhys.StepTime or programmatically within the engine code.

It interacts with the StepTime variable in the Simulate function, potentially overriding it if its value is greater than zero.

Developers should be aware that this variable is part of the internal workings of the Chaos physics system and modifying it directly (rather than through the console variable) could lead to unexpected behavior.

Best practices include using the console variable p.Chaos.ImmPhys.StepTime to modify this value rather than changing it directly in code, unless there’s a specific need to do so in a custom physics implementation.

#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:43

Scope: file

Source code excerpt:

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)"));

#Associated Variable and Callsites

This variable is associated with another variable named ChaosImmediate_Evolution_StepTime. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:34

Scope: file

Source code excerpt:

// @todo(ccaulfield): remove when finished
//
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)"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:916

Scope (from outer to inner):

file
namespace    ImmediatePhysics_Chaos
function     void FSimulation::Simulate

Source code excerpt:

			Implementation->Collisions.SetDetectorSettings(DetectorSettings);

			if (ChaosImmediate_Evolution_StepTime > 0)
			{
				StepTime = ChaosImmediate_Evolution_StepTime;
			}
			if (ChaosImmediate_Evolution_NumSteps > 0)
			{
				NumSteps = ChaosImmediate_Evolution_NumSteps;
			}
		}