p.Chaos.Solver.Iterations.Velocity
p.Chaos.Solver.Iterations.Velocity
#Overview
name: p.Chaos.Solver.Iterations.Velocity
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override number of solver velocity 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.Velocity is to override the number of solver velocity iterations in the Chaos physics system of Unreal Engine 5. This setting variable is part of the physics simulation system, specifically the Chaos solver used for rigid body dynamics.
The Chaos physics subsystem within Unreal Engine 5 relies on this setting variable. It’s part of the Experimental Chaos module, which is the new physics engine introduced in Unreal Engine 5 to replace PhysX.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of -1, which means it will use the configuration value. Users can change this value at runtime through the console or configuration files.
This variable interacts closely with its associated variable ChaosSolverVelocityIterations. They share the same value, with the console variable p.Chaos.Solver.Iterations.Velocity controlling the ChaosSolverVelocityIterations variable.
Developers must be aware that:
- Setting this variable to -1 will use the default configuration.
- This variable directly affects the physics simulation’s accuracy and performance.
- Higher values will increase accuracy but also increase computational cost.
Best practices when using this variable include:
- Only override the default value if necessary for specific scenarios.
- Balance between simulation accuracy and performance based on your game’s requirements.
- Test thoroughly when changing this value, as it can significantly impact physics behavior.
Regarding the associated variable ChaosSolverVelocityIterations:
- Its purpose is to store the number of velocity iterations the Chaos solver should perform.
- It’s used within the FPBDRigidsSolver class, specifically in the PrepareAdvanceBy function.
- The value is set either from the console variable or from the configuration, depending on whether the console variable is set to a non-negative value.
- When using this variable, developers should ensure that it’s only modified through the proper channels (i.e., the console variable or configuration files) to maintain consistency in the physics simulation.
#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:313
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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)"));
int32 ChaosSolverDeterministic = 1;
FAutoConsoleVariableRef CVarChaosSolverDeterministic(TEXT("p.Chaos.Solver.Deterministic"), ChaosSolverDeterministic, TEXT("Override determinism. 0: disabled; 1: enabled; -1: use config"));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverVelocityIterations
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:312
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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)"));
int32 ChaosSolverDeterministic = 1;
FAutoConsoleVariableRef CVarChaosSolverDeterministic(TEXT("p.Chaos.Solver.Deterministic"), ChaosSolverDeterministic, TEXT("Override determinism. 0: disabled; 1: enabled; -1: use config"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1332
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
SetPositionIterations(ChaosSolverPositionIterations);
}
if (ChaosSolverVelocityIterations >= 0)
{
SetVelocityIterations(ChaosSolverVelocityIterations);
}
if (ChaosSolverProjectionIterations >= 0)
{
SetProjectionIterations(ChaosSolverProjectionIterations);
}
if (ChaosSolverCullDistance >= 0.0f)