p.Chaos.Solver.TestMode.Step

p.Chaos.Solver.TestMode.Step

#Overview

name: p.Chaos.Solver.TestMode.Step

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Solver.TestMode.Step is to control the stepping behavior in the Chaos physics solver’s test mode. This setting variable is part of Unreal Engine’s Chaos physics system, which is an experimental physics engine used for simulating physical interactions in games and other real-time applications.

This setting variable is primarily used in the Chaos physics solver subsystem, specifically within the PBDRigidsEvolution module. It’s part of the experimental Chaos namespace, indicating that it’s still under development and may be subject to changes.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an integer and initialized to 0, as seen in the code:

int32 Chaos_Solver_TestMode_Step  = 0;
FAutoConsoleVariableRef CVarChaosSolverTestModeStep(TEXT("p.Chaos.Solver.TestMode.Step"), Chaos_Solver_TestMode_Step, TEXT(""));

This variable interacts closely with the TestModeData in the FPBDRigidsEvolutionBase class. When the value of Chaos_Solver_TestMode_Step is greater than 0, it triggers a reset of the TestModeData and decrements the step count:

if (CVars::Chaos_Solver_TestMode_Step > 0)
{
    TestModeData.Reset();
    --CVars::Chaos_Solver_TestMode_Step;
}

Developers should be aware that this variable is primarily used for testing and debugging purposes. It allows for step-by-step execution of the physics solver, which can be crucial for identifying and resolving issues in the physics simulation.

Best practices when using this variable include:

  1. Only use it in development or testing environments, not in production builds.
  2. Be aware that changing this value may affect the performance and behavior of the physics simulation.
  3. Use it in conjunction with other debugging tools and variables to get a comprehensive view of the physics system’s behavior.

The associated variable Chaos_Solver_TestMode_Step is essentially the same variable, just referenced in different parts of the code. It’s used in the same way and with the same purpose as p.Chaos.Solver.TestMode.Step. The main difference is that Chaos_Solver_TestMode_Step is the actual variable name used in the C++ code, while p.Chaos.Solver.TestMode.Step is the console variable name used to access and modify this value at runtime.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		
		int32 Chaos_Solver_TestMode_Step  = 0;
		FAutoConsoleVariableRef CVarChaosSolverTestModeStep(TEXT("p.Chaos.Solver.TestMode.Step"), Chaos_Solver_TestMode_Step, TEXT(""));
		
		// Set to true to enable some debug validation of the Particle Views every frame
		bool bChaosSolverCheckParticleViews = false;
		FAutoConsoleVariableRef CVarChaosSolverCheckParticleViews(TEXT("p.Chaos.Solver.CheckParticleViews"), bChaosSolverCheckParticleViews, TEXT(""));

		// Enable improved midphase distribution among worker threads. Without this the midphase and narrowphase run on whatever thread the

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:27

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

	{
		extern bool bChaos_Solver_TestMode_Enabled;
		extern int32 Chaos_Solver_TestMode_Step;
	}

	CHAOS_API int32 FixBadAccelerationStructureRemoval = 1;
	FAutoConsoleVariableRef CVarFixBadAccelerationStructureRemoval(TEXT("p.FixBadAccelerationStructureRemoval"), FixBadAccelerationStructureRemoval, TEXT(""));

	CHAOS_API int32 AccelerationStructureIsolateQueryOnlyObjects = 0;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:1198

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsEvolutionBase::TestModeStep

Source code excerpt:

	void FPBDRigidsEvolutionBase::TestModeStep()
	{
		if (CVars::Chaos_Solver_TestMode_Step > 0)
		{
			TestModeData.Reset();
			--CVars::Chaos_Solver_TestMode_Step;
		}
	}

	void FPBDRigidsEvolutionBase::TestModeParticleDisabled(FGeometryParticleHandle* Particle)
	{
		if (FPBDRigidParticleHandle* Rigid = Particle->CastToRigidParticle())

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverTestModeShowInitialTransforms(TEXT("p.Chaos.Solver.TestMode.ShowInitialTransforms"), bChaos_Solver_TestMode_ShowInitialTransforms, TEXT(""));
		
		int32 Chaos_Solver_TestMode_Step  = 0;
		FAutoConsoleVariableRef CVarChaosSolverTestModeStep(TEXT("p.Chaos.Solver.TestMode.Step"), Chaos_Solver_TestMode_Step, TEXT(""));
		
		// Set to true to enable some debug validation of the Particle Views every frame
		bool bChaosSolverCheckParticleViews = false;
		FAutoConsoleVariableRef CVarChaosSolverCheckParticleViews(TEXT("p.Chaos.Solver.CheckParticleViews"), bChaosSolverCheckParticleViews, TEXT(""));

		// Enable improved midphase distribution among worker threads. Without this the midphase and narrowphase run on whatever thread the