p.Chaos.Collision.CCD.CorrectionIterations
p.Chaos.Collision.CCD.CorrectionIterations
#Overview
name: p.Chaos.Collision.CCD.CorrectionIterations
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The number of post-solve CCD correction ietaryions to run.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.CCD.CorrectionIterations is to control the number of post-solve Continuous Collision Detection (CCD) correction iterations in the Chaos physics engine of Unreal Engine 5. This setting is specifically related to the collision system within the Chaos physics simulation.
-
The Chaos physics engine, which is part of Unreal Engine’s experimental features, relies on this setting variable. It’s used in the collision detection and resolution system, particularly for CCD.
-
The value of this variable is set to 4 by default, as seen in the code:
int32 ChaosCollisionCCDCorrectionIterations = 4;
. However, it can be modified at runtime through the console variable system. -
This variable interacts with another variable named
ChaosCollisionCCDCorrectionPhiToleranceScale
, which determines how much penetration is allowed during the correction phase. -
Developers must be aware that increasing this value will result in more accurate collision resolution but at the cost of performance. Conversely, decreasing it may improve performance but could lead to less accurate collision handling.
-
Best practices when using this variable include:
- Keeping it at the default value unless specific issues with CCD are observed.
- If increasing it, do so incrementally and monitor performance impacts.
- Consider the trade-off between accuracy and performance based on the specific needs of the game or simulation.
Regarding the associated variable ChaosCollisionCCDCorrectionIterations
:
- This is the actual integer variable that stores the number of CCD correction iterations.
- It’s used directly in the
FCCDManager::ApplyCorrections
function to control the maximum number of iterations in the correction loop. - The console variable
p.Chaos.Collision.CCD.CorrectionIterations
is linked to this variable, allowing runtime modification. - When adjusting this value, developers should consider the performance implications, especially in scenes with many dynamic objects or complex collision scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:55
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// How many post-solve CCD correction iterations to run
int32 ChaosCollisionCCDCorrectionIterations = 4;
FAutoConsoleVariableRef CVarChaosCollisionCCDCorrectionIterations(TEXT("p.Chaos.Collision.CCD.CorrectionIterations"), ChaosCollisionCCDCorrectionIterations, TEXT("The number of post-solve CCD correction ietaryions to run."));
// A multiplier on the constraint CCD threshold that determines how much penetration we allow in the correction phase
FRealSingle ChaosCollisionCCDCorrectionPhiToleranceScale = 0.02f;
FAutoConsoleVariableRef CVarChaosCollisionCCDCorrectionPhiToleranceScale(TEXT("p.Chaos.Collision.CCD.CorrectionPhiToleranceScale"), ChaosCollisionCCDCorrectionPhiToleranceScale, TEXT("How much penetration we allow during the correction phase (multiplier on shape size)"));
extern int32 ChaosSolverDrawCCDInteractions;
#Associated Variable and Callsites
This variable is associated with another variable named ChaosCollisionCCDCorrectionIterations
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:54
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// How many post-solve CCD correction iterations to run
int32 ChaosCollisionCCDCorrectionIterations = 4;
FAutoConsoleVariableRef CVarChaosCollisionCCDCorrectionIterations(TEXT("p.Chaos.Collision.CCD.CorrectionIterations"), ChaosCollisionCCDCorrectionIterations, TEXT("The number of post-solve CCD correction ietaryions to run."));
// A multiplier on the constraint CCD threshold that determines how much penetration we allow in the correction phase
FRealSingle ChaosCollisionCCDCorrectionPhiToleranceScale = 0.02f;
FAutoConsoleVariableRef CVarChaosCollisionCCDCorrectionPhiToleranceScale(TEXT("p.Chaos.Collision.CCD.CorrectionPhiToleranceScale"), ChaosCollisionCCDCorrectionPhiToleranceScale, TEXT("How much penetration we allow during the correction phase (multiplier on shape size)"));
extern int32 ChaosSolverDrawCCDInteractions;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:965
Scope (from outer to inner):
file
namespace Chaos
function void FCCDManager::ApplyCorrections
Source code excerpt:
// We iterate to handle stacks of CCD objects and extracting a CCD objects from a wedge.
const FReal PhiToleranceScale = CVars::ChaosCollisionCCDCorrectionPhiToleranceScale;
const int32 MaxIterations = CVars::ChaosCollisionCCDCorrectionIterations;
int32 NumIterations = 0;
bool bSolved = false;
while (!bSolved && (NumIterations < MaxIterations))
{
bSolved = true;
++NumIterations;