p.Chaos.PBDEvolution.WriteCCDContacts
p.Chaos.PBDEvolution.WriteCCDContacts
#Overview
name: p.Chaos.PBDEvolution.WriteCCDContacts
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PBDEvolution.WriteCCDContacts is to enable or disable the writing of Continuous Collision Detection (CCD) contacts and normals for debugging purposes in the Chaos physics system of Unreal Engine 5.
This setting variable is primarily used by the Chaos physics system, which is an experimental physics engine in Unreal Engine 5. It is specifically related to the Position Based Dynamics (PBD) evolution process within Chaos.
The value of this variable is set through the Unreal Engine console or configuration files. It is defined as a TAutoConsoleVariable
This variable interacts with the CollisionConstraint in the ChaosCloth system. When enabled, it sets the CollisionConstraint to write debug contacts.
Developers must be aware that enabling this variable may cause CCD collision threads to lock, as mentioned in the variable’s description. This can potentially impact performance, so it should be used cautiously and primarily for debugging purposes.
Best practices when using this variable include:
- Only enable it when actively debugging CCD collision issues.
- Disable it in production or performance-critical scenarios.
- Be prepared for potential performance impacts when enabled.
Regarding the associated variable CVarChaosPBDEvolutionWriteCCDContacts:
This is the actual console variable object that controls the behavior described above. It is used internally by the Chaos system to retrieve the current value of the setting.
The purpose of CVarChaosPBDEvolutionWriteCCDContacts is to provide programmatic access to the p.Chaos.PBDEvolution.WriteCCDContacts setting within the C++ code of the engine.
This variable is used in the Chaos PBD evolution process to determine whether to write CCD contacts. It’s typically accessed using the GetValueOnAnyThread() method to retrieve its current boolean value.
Developers should be aware that changes to this variable will directly affect the behavior of the Chaos physics system, particularly in relation to CCD contact debugging.
Best practices for using CVarChaosPBDEvolutionWriteCCDContacts include:
- Use GetValueOnAnyThread() to access its value in performance-critical code.
- Consider caching the value if it’s accessed frequently in a single frame or update cycle.
- Be mindful of the performance implications when enabling this feature in your code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:36
Scope: file
Source code excerpt:
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionUseSmoothTimeStep(TEXT("p.Chaos.PBDEvolution.UseSmoothTimeStep"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<int32> CVarChaosPBDEvolutionMinParallelBatchSize(TEXT("p.Chaos.PBDEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionWriteCCDContacts(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"), false, TEXT("Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts."), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionParallelIntegrate(TEXT("p.Chaos.PBDEvolution.ParalleIntegrate"), false, TEXT("Run the integration step in parallel for."), ECVF_Cheat);
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in PBD Post iteration updates"));
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothConstraints.cpp:2316
Scope (from outer to inner):
file
namespace Chaos
function void FClothConstraints::Update
Source code excerpt:
if (CollisionConstraint)
{
static IConsoleVariable* const WriteCCDContacts = IConsoleManager::Get().FindConsoleVariable(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"));
const bool bWriteCCDContacts = WriteCCDContacts ? WriteCCDContacts->GetBool() : false;
CollisionConstraint->SetProperties(ConfigProperties);
CollisionConstraint->SetWriteDebugContacts(bWriteCCDContacts);
}
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarChaosPBDEvolutionWriteCCDContacts
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:36
Scope: file
Source code excerpt:
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionUseSmoothTimeStep(TEXT("p.Chaos.PBDEvolution.UseSmoothTimeStep"), true, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<int32> CVarChaosPBDEvolutionMinParallelBatchSize(TEXT("p.Chaos.PBDEvolution.MinParallelBatchSize"), 300, TEXT(""), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionWriteCCDContacts(TEXT("p.Chaos.PBDEvolution.WriteCCDContacts"), false, TEXT("Write CCD collision contacts and normals potentially causing the CCD collision threads to lock, allowing for debugging of these contacts."), ECVF_Cheat);
TAutoConsoleVariable<bool> CVarChaosPBDEvolutionParallelIntegrate(TEXT("p.Chaos.PBDEvolution.ParalleIntegrate"), false, TEXT("Run the integration step in parallel for."), ECVF_Cheat);
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in PBD Post iteration updates"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:478
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDEvolution::AdvanceOneTimeStep
Source code excerpt:
TNumericLimits<int32>::Max() : // Disable
CVarChaosPBDEvolutionMinParallelBatchSize.GetValueOnAnyThread(); // TODO: 1000 is a guess, tune this!
const bool bWriteCCDContacts = CVarChaosPBDEvolutionWriteCCDContacts.GetValueOnAnyThread();
{
TRACE_CPUPROFILER_EVENT_SCOPE(ChaosPBDPreIterationUpdates);
SCOPE_CYCLE_COUNTER(STAT_ChaosPBDPreIterationUpdates);
MParticlesActiveView.RangeFor(