p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp

p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp

#Overview

name: p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp

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.Joint.TransferCollisionsDebugTestAgainstMaxClamp is to provide a debugging tool for the Chaos physics solver in Unreal Engine 5, specifically for joint collision constraints. This setting variable is used to force all joint collision constraint settings to their maximum clamp value, which helps validate stability in the physics simulation.

This setting variable is primarily used in the Chaos physics solver, which is part of the Experimental Chaos module in Unreal Engine 5. Based on the callsites, it’s specifically used in the PBDRigidsEvolutionGBF (Position Based Dynamics Rigid Evolution) system, which is responsible for simulating rigid body dynamics.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console or configuration files. By default, it is set to false.

This variable interacts with another variable named TransferCollisionsStiffnessClamp. When TransferCollisionsDebugTestAgainstMaxClamp is set to true, the CollisionConstraintStiffness is set to the value of TransferCollisionsStiffnessClamp instead of using the joint’s normal contact transfer scale.

Developers must be aware that enabling this variable will override the normal behavior of joint collision constraints, which could significantly affect the physics simulation. It should only be used for debugging and stability validation purposes, not in normal gameplay scenarios.

Best practices when using this variable include:

  1. Use it temporarily for debugging purposes only.
  2. Be prepared for potentially unstable or unrealistic physics behavior when enabled.
  3. Always test the game thoroughly with this setting disabled before releasing.

Regarding the associated variable TransferCollisionsDebugTestAgainstMaxClamp:

The purpose of TransferCollisionsDebugTestAgainstMaxClamp is to act as the actual boolean flag that controls whether the maximum clamp value should be used for joint collision constraints. It’s the implementation variable for the console command.

This variable is used in the same Chaos physics solver subsystem, specifically in the TransferJointConstraintCollisions function of the FPBDRigidsEvolutionGBF class.

Its value is set by the FAutoConsoleVariableRef, which links it to the console command p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp.

It directly interacts with the TransferCollisionsStiffnessClamp variable, using its value when the debug test is enabled.

Developers should be aware that this variable directly affects the physics simulation when enabled, and should be used cautiously.

Best practices for this variable are the same as for the console command it’s associated with, as they effectively control the same functionality.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		bool TransferCollisionsDebugTestAgainstMaxClamp = false;
		FAutoConsoleVariableRef CVarTransferCollisionsDebugTestAgainstMaxClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp"), TransferCollisionsDebugTestAgainstMaxClamp, TEXT("Force all joint collision constraint settings to max clamp value to validate stability [def:false]"));

		bool DoFinalProbeNarrowPhase = true;
		FAutoConsoleVariableRef CVarDoFinalProbeNarrowPhase(TEXT("p.Chaos.Solver.DoFinalProbeNarrowPhase"), DoFinalProbeNarrowPhase, TEXT(""));

		// Enable inertia conditioning for joint and collisions stabilization for small and thin objects
		bool bChaosSolverInertiaConditioningEnabled = true;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:94

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarTransferCollisionsStiffnessClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp"), TransferCollisionsStiffnessClamp, TEXT("Clamp of maximum value of the stiffness clamp[def:1.0]"));

		bool TransferCollisionsDebugTestAgainstMaxClamp = false;
		FAutoConsoleVariableRef CVarTransferCollisionsDebugTestAgainstMaxClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp"), TransferCollisionsDebugTestAgainstMaxClamp, TEXT("Force all joint collision constraint settings to max clamp value to validate stability [def:false]"));

		bool DoFinalProbeNarrowPhase = true;
		FAutoConsoleVariableRef CVarDoFinalProbeNarrowPhase(TEXT("p.Chaos.Solver.DoFinalProbeNarrowPhase"), DoFinalProbeNarrowPhase, TEXT(""));

		// Enable inertia conditioning for joint and collisions stabilization for small and thin objects
		bool bChaosSolverInertiaConditioningEnabled = true;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:1283

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsEvolutionGBF::TransferJointConstraintCollisions
lambda-function

Source code excerpt:


						FReal CollisionConstraintStiffness = JointConstraint->GetSettings().ContactTransferScale;
						if (TransferCollisionsDebugTestAgainstMaxClamp)
						{
							CollisionConstraintStiffness = TransferCollisionsStiffnessClamp;
						}

						if (CollisionParticleA.Get() && CollisionParticleA->ObjectState() != EObjectStateType::Dynamic)
						{