p.Chaos.Solver.Iterations.Position
p.Chaos.Solver.Iterations.Position
#Overview
name: p.Chaos.Solver.Iterations.Position
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override number of solver position iterations (-1 to use config)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Iterations.Position is to control the number of position iterations in the Chaos physics solver within Unreal Engine 5. This setting variable is specifically used for the physics simulation system, particularly the Chaos solver.
This setting variable is primarily used by the Chaos physics module, which is part of Unreal Engine’s experimental features. It’s referenced in the PBDRigidsSolver (Position Based Dynamics Rigids Solver) component of the Chaos system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of -1, which indicates that the configuration value should be used. Users can override this value at runtime using the console command system.
The associated variable ChaosSolverPositionIterations directly interacts with p.Chaos.Solver.Iterations.Position. They share the same value, with ChaosSolverPositionIterations being the actual integer variable used in the code.
Developers must be aware that:
- Setting this variable to a value >= 0 will override the configuration value.
- The variable affects the accuracy and performance of the physics simulation.
- Higher values may increase accuracy but at the cost of performance.
Best practices when using this variable include:
- Leave it at -1 unless specific adjustments are needed, to use the default configuration.
- When adjusting, start with small increments and test thoroughly.
- Balance between simulation accuracy and performance based on the specific needs of the game or application.
Regarding the associated variable ChaosSolverPositionIterations:
- Its purpose is to store the actual number of position iterations used by the solver.
- It’s used directly in the Chaos physics module, specifically in the FPBDRigidsSolver class.
- Its value is set either by the console variable or through the configuration.
- It interacts with the SetPositionIterations method of the physics solver.
- Developers should be aware that changing this value directly in code might be overridden by the console variable if set.
- Best practice is to use the console variable for runtime adjustments and configuration for default values, rather than hardcoding values for ChaosSolverPositionIterations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:310
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverPositionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverIterations(TEXT("p.Chaos.Solver.Iterations.Position"), ChaosSolverPositionIterations, TEXT("Override number of solver position iterations (-1 to use config)"));
int32 ChaosSolverVelocityIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverPushOutIterations(TEXT("p.Chaos.Solver.Iterations.Velocity"), ChaosSolverVelocityIterations, TEXT("Override number of solver velocity iterations (-1 to use config)"));
int32 ChaosSolverProjectionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverProjectionIterations(TEXT("p.Chaos.Solver.Iterations.Projection"), ChaosSolverProjectionIterations, TEXT("Override number of solver projection iterations (-1 to use config)"));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverPositionIterations
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:309
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverCollisionVelocityShockPropagationIterations(TEXT("p.Chaos.Solver.Collision.VelocityShockPropagationIterations"), ChaosSolverCollisionVelocityShockPropagationIterations, TEXT("Override number of velocity iterations where shock propagation is applied (if >= 0)"));
int32 ChaosSolverPositionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverIterations(TEXT("p.Chaos.Solver.Iterations.Position"), ChaosSolverPositionIterations, TEXT("Override number of solver position iterations (-1 to use config)"));
int32 ChaosSolverVelocityIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverPushOutIterations(TEXT("p.Chaos.Solver.Iterations.Velocity"), ChaosSolverVelocityIterations, TEXT("Override number of solver velocity iterations (-1 to use config)"));
int32 ChaosSolverProjectionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverProjectionIterations(TEXT("p.Chaos.Solver.Iterations.Projection"), ChaosSolverProjectionIterations, TEXT("Override number of solver projection iterations (-1 to use config)"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1328
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
MEvolution->SetShockPropagationIterations(ChaosSolverCollisionPositionShockPropagationIterations, ChaosSolverCollisionVelocityShockPropagationIterations);
}
if (ChaosSolverPositionIterations >= 0)
{
SetPositionIterations(ChaosSolverPositionIterations);
}
if (ChaosSolverVelocityIterations >= 0)
{
SetVelocityIterations(ChaosSolverVelocityIterations);
}
if (ChaosSolverProjectionIterations >= 0)