p.Chaos.ConstraintGraph.Validate

p.Chaos.ConstraintGraph.Validate

#Overview

name: p.Chaos.ConstraintGraph.Validate

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.ConstraintGraph.Validate is to enable or disable per-tick validation checks and assertions for the Constraint Graph in the Chaos physics system of Unreal Engine 5. This setting variable is primarily used for debugging and ensuring the integrity of the Constraint Graph during runtime.

This setting variable is utilized by the Chaos physics system, specifically within the Island Manager module. The Chaos physics system is an experimental physics solver in Unreal Engine 5, designed to provide more accurate and performant physics simulations.

The value of this variable is set through the Unreal Engine console variable system. It is declared and initialized in the Chaos::CVars namespace within the IslandManager.cpp file.

The associated variable bChaosConstraintGraphValidate interacts directly with p.Chaos.ConstraintGraph.Validate. They share the same value, with bChaosConstraintGraphValidate being the actual boolean variable used in the code to control the validation behavior.

Developers should be aware that enabling this variable may have performance implications, as it introduces additional validation checks during each physics tick. These checks are meant for debugging purposes and should typically be disabled in release builds or when maximum performance is required.

Best practices when using this variable include:

  1. Enable it during development and testing phases to catch potential issues with the Constraint Graph.
  2. Disable it in release builds to avoid unnecessary performance overhead.
  3. Use it in conjunction with other debugging tools when investigating physics-related problems.

Regarding the associated variable bChaosConstraintGraphValidate:

Developers should note that modifying bChaosConstraintGraphValidate directly in code will not affect the console variable. Changes should be made through the console variable system to ensure consistency between the two.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Island/IslandManager.cpp:43

Scope (from outer to inner):

file
namespace    Chaos::CVars

Source code excerpt:


	bool bChaosConstraintGraphValidate = (CHAOS_CONSTRAINTGRAPH_CHECK_ENABLED != 0);
	FAutoConsoleVariableRef CVarChaosConstraintGraphValidate(TEXT("p.Chaos.ConstraintGraph.Validate"), bChaosConstraintGraphValidate, TEXT("Enable per-tick ConstraintGraph validation checks/assertions"));

	/** Cvar to enable/disable the island sleeping */
	bool bChaosSolverSleepEnabled = true;
	FAutoConsoleVariableRef CVarChaosSolverSleepEnabled(TEXT("p.Chaos.Solver.Sleep.Enabled"), bChaosSolverSleepEnabled, TEXT(""));

	/** Cvar to override the sleep counter threshold if necessary */

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Island/IslandManager.cpp:42

Scope (from outer to inner):

file
namespace    Chaos::CVars

Source code excerpt:

	extern FRealSingle SmoothedPositionLerpRate;

	bool bChaosConstraintGraphValidate = (CHAOS_CONSTRAINTGRAPH_CHECK_ENABLED != 0);
	FAutoConsoleVariableRef CVarChaosConstraintGraphValidate(TEXT("p.Chaos.ConstraintGraph.Validate"), bChaosConstraintGraphValidate, TEXT("Enable per-tick ConstraintGraph validation checks/assertions"));

	/** Cvar to enable/disable the island sleeping */
	bool bChaosSolverSleepEnabled = true;
	FAutoConsoleVariableRef CVarChaosSolverSleepEnabled(TEXT("p.Chaos.Solver.Sleep.Enabled"), bChaosSolverSleepEnabled, TEXT(""));

	/** Cvar to override the sleep counter threshold if necessary */

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Island/IslandManager.cpp:2437

Scope (from outer to inner):

file
namespace    Chaos::Private
function     bool FPBDIslandManager::Validate

Source code excerpt:

		SCOPE_CYCLE_COUNTER(STAT_IslandManager_Validate);

		if (!CVars::bChaosConstraintGraphValidate)
		{
			return true;
		}

		bool bIsValid = true;