p.Chaos.Solver.TestMode.Enabled
p.Chaos.Solver.TestMode.Enabled
#Overview
name: p.Chaos.Solver.TestMode.Enabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.TestMode.Enabled is to enable a test mode for the Chaos physics solver in Unreal Engine 5. This setting is primarily used for debugging and testing the physics simulation within the Chaos system.
This setting variable is primarily used in the Chaos module, which is part of Unreal Engine’s experimental physics system. It is referenced in the PBDRigidsEvolution and PBDRigidsEvolutionGBF components of the Chaos system.
The value of this variable is set through a console variable (CVar) system. It is initialized as false and can be changed at runtime using the console command “p.Chaos.Solver.TestMode.Enabled”.
This variable interacts closely with other test mode-related variables, such as:
- p.Chaos.Solver.TestMode.ShowInitialTransforms
- p.Chaos.Solver.TestMode.Step
Developers should be aware that enabling this test mode may significantly alter the behavior of the physics simulation. It’s designed for debugging and testing purposes, not for regular gameplay or production use.
Best practices when using this variable include:
- Only enable it when actively debugging physics issues.
- Be aware that it may affect performance and gameplay behavior.
- Use it in conjunction with other test mode variables for comprehensive debugging.
- Disable it before finalizing or shipping the game.
Regarding the associated variable bChaos_Solver_TestMode_Enabled:
This is the internal C++ variable that directly corresponds to the console variable p.Chaos.Solver.TestMode.Enabled. It’s used throughout the Chaos physics code to check if the test mode is enabled.
The purpose of bChaos_Solver_TestMode_Enabled is to provide a quick, efficient way for the code to check if the test mode is active without having to query the console variable system each time.
This variable is used in various functions within the Chaos system, particularly in the PBDRigidsEvolution class, to conditionally execute test mode-specific code. For example, it’s used in functions like TestModeSaveParticles, TestModeUpdateSavedParticle, and TestModeRestoreParticles.
Developers should not modify this variable directly in code. Instead, they should use the console variable p.Chaos.Solver.TestMode.Enabled to control the test mode. The bChaos_Solver_TestMode_Enabled variable will automatically reflect the state of the console variable.
#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:175
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// p.DisableEditorPhysicsHandle 1
bool bChaos_Solver_TestMode_Enabled = false;
FAutoConsoleVariableRef CVarChaosSolverTestModeEnabled(TEXT("p.Chaos.Solver.TestMode.Enabled"), bChaos_Solver_TestMode_Enabled, TEXT(""));
bool bChaos_Solver_TestMode_ShowInitialTransforms = false;
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(""));
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_Solver_TestMode_Enabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:26
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
namespace CVars
{
extern bool bChaos_Solver_TestMode_Enabled;
extern int32 Chaos_Solver_TestMode_Step;
}
CHAOS_API int32 FixBadAccelerationStructureRemoval = 1;
FAutoConsoleVariableRef CVarFixBadAccelerationStructureRemoval(TEXT("p.FixBadAccelerationStructureRemoval"), FixBadAccelerationStructureRemoval, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:1215
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::TestModeSaveParticles
Source code excerpt:
void FPBDRigidsEvolutionBase::TestModeSaveParticles()
{
if (!CVars::bChaos_Solver_TestMode_Enabled)
{
return;
}
for (auto& Rigid : Particles.GetNonDisabledDynamicView())
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:1228
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::TestModeSaveParticle
Source code excerpt:
void FPBDRigidsEvolutionBase::TestModeSaveParticle(FGeometryParticleHandle* Particle)
{
if (!CVars::bChaos_Solver_TestMode_Enabled)
{
return;
}
if (FPBDRigidParticleHandle* Rigid = Particle->CastToRigidParticle())
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:1246
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::TestModeUpdateSavedParticle
Source code excerpt:
void FPBDRigidsEvolutionBase::TestModeUpdateSavedParticle(FGeometryParticleHandle* Particle)
{
if (!CVars::bChaos_Solver_TestMode_Enabled)
{
return;
}
if (FPBDRigidParticleHandle* Rigid = Particle->CastToRigidParticle())
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:1268
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::TestModeRestoreParticles
Source code excerpt:
void FPBDRigidsEvolutionBase::TestModeRestoreParticles()
{
if (!CVars::bChaos_Solver_TestMode_Enabled)
{
return;
}
for (auto& Rigid : Particles.GetNonDisabledDynamicView())
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:1286
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::TestModeRestoreParticle
Source code excerpt:
void FPBDRigidsEvolutionBase::TestModeRestoreParticle(FGeometryParticleHandle* Particle)
{
if (!CVars::bChaos_Solver_TestMode_Enabled)
{
return;
}
if (FPBDRigidParticleHandle* Rigid = Particle->CastToRigidParticle())
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:174
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// NOTE: You should also set the following for dragging in PIE to work while test mode is active:
// p.DisableEditorPhysicsHandle 1
bool bChaos_Solver_TestMode_Enabled = false;
FAutoConsoleVariableRef CVarChaosSolverTestModeEnabled(TEXT("p.Chaos.Solver.TestMode.Enabled"), bChaos_Solver_TestMode_Enabled, TEXT(""));
bool bChaos_Solver_TestMode_ShowInitialTransforms = false;
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(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:702
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::AdvanceOneTimeStepImpl
Source code excerpt:
#if CHAOS_EVOLUTION_COLLISION_TESTMODE
if (CVars::bChaos_Solver_TestMode_Enabled && CVars::bChaos_Solver_TestMode_ShowInitialTransforms)
{
TestModeRestoreParticles();
}
#endif
if (CVars::DoFinalProbeNarrowPhase)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:1673
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::TestModeResetCollisions
Source code excerpt:
void FPBDRigidsEvolutionGBF::TestModeResetCollisions()
{
if (!CVars::bChaos_Solver_TestMode_Enabled)
{
return;
}
for (FPBDCollisionConstraintHandle* Collision : CollisionConstraints.GetConstraintHandles())
{