p.Chaos.Solver.Collision.SolverType
p.Chaos.Solver.Collision.SolverType
#Overview
name: p.Chaos.Solver.Collision.SolverType
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
-1: Use default (Gauss Seidel); 0: Gauss Seidel; 1: Gauss Seidel SOA 2: Partial Jacobi
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Collision.SolverType is to determine the type of collision solver used in the Chaos physics system of Unreal Engine 5. This setting variable is part of the physics simulation subsystem, specifically the collision handling component.
The Unreal Engine subsystem that relies on this setting variable is the Chaos physics system, which is part of the Experimental namespace. This suggests that the Chaos physics system is still in development and may not be fully stable for production use.
The value of this variable is set through a console variable (cvar) system. It’s initialized with a default value of -1 and can be changed at runtime through the console or configuration files.
This variable interacts directly with its associated variable ChaosSolverCollisionSolverType. They share the same value, with ChaosSolverCollisionSolverType being the actual integer variable that stores the solver type.
Developers must be aware that:
- The variable accepts integer values with specific meanings:
- -1: Use default (Gauss Seidel)
- 0: Gauss Seidel
- 1: Gauss Seidel SOA (Structure of Arrays)
- 2: Partial Jacobi
- Changing this value at runtime will destroy and recreate existing solvers, which can impact performance.
- This feature is part of the Experimental namespace, indicating it may not be stable for production use.
Best practices when using this variable include:
- Use the default value (-1) unless there’s a specific need for a different solver type.
- Avoid changing this value frequently during runtime due to the performance impact of recreating solvers.
- Test thoroughly when using non-default values to ensure desired behavior and performance.
Regarding the associated variable ChaosSolverCollisionSolverType:
The purpose of ChaosSolverCollisionSolverType is to store the actual integer value representing the chosen collision solver type in the Chaos physics system.
This variable is used directly in the Chaos physics system’s collision handling code. It’s checked in the UpdateCollisionSolverType function to determine if the solver type has changed and to map the integer value to the corresponding ECollisionSolverType enum.
The value of this variable is set through the console variable system, sharing the same value as p.Chaos.Solver.Collision.SolverType.
ChaosSolverCollisionSolverType interacts closely with the ECollisionSolverType enum, which is used to represent the solver type in a more type-safe manner within the physics code.
Developers should be aware that this variable is the actual storage for the solver type and is used directly in the physics code. Any changes to p.Chaos.Solver.Collision.SolverType will be reflected in this variable.
Best practices for ChaosSolverCollisionSolverType align with those for p.Chaos.Solver.Collision.SolverType, as they are essentially two representations of the same setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:68
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// Collision Solver Type (see ECollisionSolverType)
int32 ChaosSolverCollisionSolverType = -1;
FAutoConsoleVariableRef CVarChaosSolverCollisionSolverType(TEXT("p.Chaos.Solver.Collision.SolverType"), ChaosSolverCollisionSolverType, TEXT("-1: Use default (Gauss Seidel); 0: Gauss Seidel; 1: Gauss Seidel SOA 2: Partial Jacobi"));
int32 ChaosSolverCollisionPriority = 0;
FAutoConsoleVariableRef CVarChaosSolverCollisionPriority(TEXT("p.Chaos.Solver.Collision.Priority"), ChaosSolverCollisionPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));
int32 ChaosSolverJointPriority = 0;
FAutoConsoleVariableRef CVarChaosSolverJointPriority(TEXT("p.Chaos.Solver.Joint.Priority"), ChaosSolverJointPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverCollisionSolverType
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:67
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// Collision Solver Type (see ECollisionSolverType)
int32 ChaosSolverCollisionSolverType = -1;
FAutoConsoleVariableRef CVarChaosSolverCollisionSolverType(TEXT("p.Chaos.Solver.Collision.SolverType"), ChaosSolverCollisionSolverType, TEXT("-1: Use default (Gauss Seidel); 0: Gauss Seidel; 1: Gauss Seidel SOA 2: Partial Jacobi"));
int32 ChaosSolverCollisionPriority = 0;
FAutoConsoleVariableRef CVarChaosSolverCollisionPriority(TEXT("p.Chaos.Solver.Collision.Priority"), ChaosSolverCollisionPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));
int32 ChaosSolverJointPriority = 0;
FAutoConsoleVariableRef CVarChaosSolverJointPriority(TEXT("p.Chaos.Solver.Joint.Priority"), ChaosSolverJointPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:402
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::UpdateCollisionSolverType
Source code excerpt:
// If we have changed the collision solver type we must destroy any existing solvers so that they get recreated.
// This is not intended to be performant - it is to allow switching for behaviour and performance comparisons only, without restarting the game.
if (ChaosSolverCollisionSolverType >= 0)
{
// Map the cvar to an enum value. Invalid values are assumed to mean Gauss Seidel
Private::ECollisionSolverType CollisionSolverType = Private::ECollisionSolverType::GaussSeidel;
if (ChaosSolverCollisionSolverType == 1)
{
CollisionSolverType = Private::ECollisionSolverType::GaussSeidelSimd;
}
else if (ChaosSolverCollisionSolverType == 2)
{
CollisionSolverType = Private::ECollisionSolverType::PartialJacobi;
}
if (CollisionSolverType != CollisionConstraints.GetSolverType())
{