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).

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:

  1. Setting this variable to -1 will use the default configuration.
  2. This variable directly affects the physics simulation’s accuracy and performance.
  3. Higher values will increase accuracy but also increase computational cost.

Best practices when using this variable include:

  1. Only override the default value if necessary for specific scenarios.
  2. Balance between simulation accuracy and performance based on your game’s requirements.
  3. Test thoroughly when changing this value, as it can significantly impact physics behavior.

Regarding the associated variable ChaosSolverVelocityIterations:

#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)