p.Chaos.ImmPhys.Joint.UseLinearSolver

p.Chaos.ImmPhys.Joint.UseLinearSolver

#Overview

name: p.Chaos.ImmPhys.Joint.UseLinearSolver

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.Joint.UseLinearSolver is to control whether the linear joint solver is used in the Chaos physics engine within Unreal Engine 5. This setting is specifically for the Immediate Physics simulation in the Chaos system.

This setting variable is primarily used in the Chaos physics subsystem, particularly in the Immediate Physics module. It’s part of the Engine’s physics simulation capabilities.

The value of this variable is set through a console variable (CVar) system. It’s initialized to -1 and can be changed at runtime through console commands or programmatically.

The associated variable ChaosImmediate_Joint_UseLinearSolver directly interacts with p.Chaos.ImmPhys.Joint.UseLinearSolver. They share the same value, with the CVar acting as an interface to modify the internal variable.

Developers must be aware that this setting only applies to the QuasiPBD (Position Based Dynamics) Solver in the Chaos physics system. The linear solver is significantly faster but less accurate than the non-linear solver.

Best practices when using this variable include:

  1. Use -1 to rely on the PhysicsAsset setting, which allows for more granular control per asset.
  2. Set to 1 for performance-critical scenarios where slight inaccuracies are acceptable.
  3. Set to 0 for scenarios requiring high accuracy in joint simulations.

Regarding the associated variable ChaosImmediate_Joint_UseLinearSolver:

Its purpose is to store the actual value used by the physics simulation code. It’s an internal representation of the console variable.

This variable is used within the Chaos Immediate Physics simulation system, specifically in the joint solving step of the physics update.

The value is set either through the console variable or potentially through other initialization methods in the physics system.

It interacts directly with the p.Chaos.ImmPhys.Joint.UseLinearSolver CVar, serving as the actual value the physics code references.

Developers should be aware that modifying this variable directly (instead of through the CVar) might lead to inconsistencies between the displayed console variable value and the actual behavior.

Best practices include using the CVar system to modify this value rather than changing it directly in code, ensuring consistency across the engine’s systems.

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

Scope: file

Source code excerpt:

// Whether to use the linear joint solver which is significantly faster than the non-linear one but less accurate. Only applies to the QuasiPBD Solver
int32 ChaosImmediate_Joint_UseLinearSolver = -1;
FAutoConsoleVariableRef CVarChaosImmPhysJointUseCachedSolver(TEXT("p.Chaos.ImmPhys.Joint.UseLinearSolver"), ChaosImmediate_Joint_UseLinearSolver, TEXT("Force use of linear or non-linear joint solver. (-1 to use PhysicsAsset setting)"));

//
// end remove when finished
//
//////////////////////////////////////////////////////////////////////////

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:


// Whether to use the linear joint solver which is significantly faster than the non-linear one but less accurate. Only applies to the QuasiPBD Solver
int32 ChaosImmediate_Joint_UseLinearSolver = -1;
FAutoConsoleVariableRef CVarChaosImmPhysJointUseCachedSolver(TEXT("p.Chaos.ImmPhys.Joint.UseLinearSolver"), ChaosImmediate_Joint_UseLinearSolver, TEXT("Force use of linear or non-linear joint solver. (-1 to use PhysicsAsset setting)"));

//
// end remove when finished
//
//////////////////////////////////////////////////////////////////////////

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

Scope (from outer to inner):

file
namespace    ImmediatePhysics_Chaos
function     void FSimulation::Simulate

Source code excerpt:

				ChaosImmediate_Collision_CullDistance,
				ChaosImmediate_Collision_MaxDepenetrationVelocity,
				ChaosImmediate_Joint_UseLinearSolver,
				ChaosImmediate_Evolution_PositionIterations,
				ChaosImmediate_Evolution_VelocityIterations,
				ChaosImmediate_Evolution_ProjectionIterations);

			FPBDJointSolverSettings JointsSettings = Implementation->Joints.GetSettings();
			JointsSettings.SwingTwistAngleTolerance = ChaosImmediate_Joint_SwingTwistAngleTolerance;