p.Chaos.Collision.CCD.CorrectionPhiToleranceScale
p.Chaos.Collision.CCD.CorrectionPhiToleranceScale
#Overview
name: p.Chaos.Collision.CCD.CorrectionPhiToleranceScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
How much penetration we allow during the correction phase (multiplier on shape size)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.CCD.CorrectionPhiToleranceScale is to control the amount of penetration allowed during the correction phase of Continuous Collision Detection (CCD) in the Chaos physics engine. This setting is specifically for the collision system within the Chaos physics simulation.
This setting variable is primarily used by the Chaos physics engine, which is part of Unreal Engine’s experimental physics system. It’s specifically utilized in the CCD (Continuous Collision Detection) subsystem of the Chaos collision handling.
The value of this variable is set in the Chaos::CVars namespace in the CCDUtilities.cpp file. It’s initialized with a default value of 0.02f and can be modified at runtime through the console variable system.
The associated variable ChaosCollisionCCDCorrectionPhiToleranceScale directly interacts with p.Chaos.Collision.CCD.CorrectionPhiToleranceScale. They share the same value, with the console variable (p.Chaos.Collision.CCD.CorrectionPhiToleranceScale) controlling the value of ChaosCollisionCCDCorrectionPhiToleranceScale.
Developers must be aware that this variable affects the precision of collision detection and resolution in high-speed scenarios. A higher value allows more penetration, which can lead to faster but less accurate simulations. A lower value enforces stricter collision resolution but may increase computational cost.
Best practices when using this variable include:
- Fine-tuning it based on the specific needs of the game or simulation.
- Testing thoroughly with different values to find the right balance between performance and accuracy.
- Being cautious when modifying it, as it can significantly impact the behavior of fast-moving objects in the simulation.
Regarding the associated variable ChaosCollisionCCDCorrectionPhiToleranceScale:
- Its purpose is to store the actual value used in the CCD calculations.
- It’s used directly in the ApplyCorrections function of the FCCDManager class.
- The value is set by the console variable system and can be changed at runtime.
- Developers should be aware that changing this value will directly affect the CCD correction behavior in the Chaos physics simulation.
- Best practice is to modify this value through the console variable (p.Chaos.Collision.CCD.CorrectionPhiToleranceScale) rather than directly, to ensure consistency across the engine.
#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:59
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// 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;
#if CHAOS_DEBUG_DRAW
extern DebugDraw::FChaosDebugDrawSettings ChaosSolverDebugDebugDrawSettings;
#endif
#Associated Variable and Callsites
This variable is associated with another variable named ChaosCollisionCCDCorrectionPhiToleranceScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:58
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// 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;
#if CHAOS_DEBUG_DRAW
extern DebugDraw::FChaosDebugDrawSettings ChaosSolverDebugDebugDrawSettings;
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:964
Scope (from outer to inner):
file
namespace Chaos
function void FCCDManager::ApplyCorrections
Source code excerpt:
// move the two bodies so that they are no longer penetrating.
// 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;