p.Chaos.CCD.AxisThresholdMode
p.Chaos.CCD.AxisThresholdMode
#Overview
name: p.Chaos.CCD.AxisThresholdMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Change the mode used to generate CCD axis threshold bounds for particle geometries.\n0: Use object bounds\n1: Find the thinnest object bound on any axis and use it for all CCD axes\n2: On each axis, use the thinnest shape bound on that axis\n3: Find the thinnest shape bound on any axis and use this for all axes
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.CCD.AxisThresholdMode is to control how Continuous Collision Detection (CCD) axis threshold bounds are generated for particle geometries in Unreal Engine’s Chaos physics system.
This setting variable is primarily used by the Chaos physics system, which is part of Unreal Engine’s experimental physics simulation module. It specifically affects the CCD calculations, which are crucial for preventing fast-moving objects from passing through each other without detecting collisions.
The value of this variable is set through a console variable (CVar) system, allowing it to be changed at runtime. It’s initialized with a default value of 2 in the code.
The associated variable CCDAxisThresholdMode directly interacts with p.Chaos.CCD.AxisThresholdMode, sharing the same value. This variable is used in the actual logic of the physics simulation.
Developers should be aware that this variable has four possible modes (0-3), each affecting how the CCD axis threshold bounds are calculated: 0: Use object bounds 1: Find the thinnest object bound on any axis and use it for all CCD axes 2: On each axis, use the thinnest shape bound on that axis 3: Find the thinnest shape bound on any axis and use this for all axes
Best practices when using this variable include:
- Understanding the trade-offs between performance and accuracy for each mode.
- Testing thoroughly with different modes to find the best balance for your specific use case.
- Being cautious when changing this value at runtime, as it can significantly affect physics behavior.
Regarding the associated variable CCDAxisThresholdMode:
- It’s purpose is the same as p.Chaos.CCD.AxisThresholdMode, serving as the internal representation of the setting.
- It’s used directly in the physics calculations, particularly in the UpdateCCDAxisThreshold function of the TGeometryParticlesImp class.
- The value is set through the console variable system, allowing for runtime changes.
- It interacts closely with other CCD-related variables and the geometry data of physics objects.
- Developers should be aware that changing this value will directly affect the physics simulation’s behavior.
- Best practices include thorough testing when modifying this value and considering its impact on both performance and simulation accuracy.
#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:45
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 CCDAxisThresholdMode = 2;
FAutoConsoleVariableRef CVarCCDAxisThresholdMode(TEXT("p.Chaos.CCD.AxisThresholdMode"), CCDAxisThresholdMode , TEXT("Change the mode used to generate CCD axis threshold bounds for particle geometries.\n0: Use object bounds\n1: Find the thinnest object bound on any axis and use it for all CCD axes\n2: On each axis, use the thinnest shape bound on that axis\n3: Find the thinnest shape bound on any axis and use this for all axes"));
bool bCCDAxisThresholdUsesProbeShapes = false;
FAutoConsoleVariableRef CVarCCDAxisThresholdUsesProbeShapes(TEXT("p.Chaos.CCD.CCDAxisThresholdUsesProbeShapes"), bCCDAxisThresholdUsesProbeShapes , TEXT("When true, probe shapes are considered for CCD axis threshold computation, and can generate contacts in the initial CCD phase."));
bool bCCDSweepsUseProbeShapes = false;
FAutoConsoleVariableRef CVarCCDSweepsUseProbeShapes(TEXT("p.Chaos.CCD.CCDSweepsUseProbeShapes"), bCCDSweepsUseProbeShapes , TEXT("When true, probe shapes can be swept for more accurate collision detection."));
#Associated Variable and Callsites
This variable is associated with another variable named CCDAxisThresholdMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:44
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarCCDNewTargetDepthMode(TEXT("p.Chaos.CCD.NewTargetDepthMode"), bCCDNewTargetDepthMode, TEXT("Find the first contact with that results in a penetration of (CCDAllowedDepthBoundsScale*Size) as opposed to the first contact"));
int32 CCDAxisThresholdMode = 2;
FAutoConsoleVariableRef CVarCCDAxisThresholdMode(TEXT("p.Chaos.CCD.AxisThresholdMode"), CCDAxisThresholdMode , TEXT("Change the mode used to generate CCD axis threshold bounds for particle geometries.\n0: Use object bounds\n1: Find the thinnest object bound on any axis and use it for all CCD axes\n2: On each axis, use the thinnest shape bound on that axis\n3: Find the thinnest shape bound on any axis and use this for all axes"));
bool bCCDAxisThresholdUsesProbeShapes = false;
FAutoConsoleVariableRef CVarCCDAxisThresholdUsesProbeShapes(TEXT("p.Chaos.CCD.CCDAxisThresholdUsesProbeShapes"), bCCDAxisThresholdUsesProbeShapes , TEXT("When true, probe shapes are considered for CCD axis threshold computation, and can generate contacts in the initial CCD phase."));
bool bCCDSweepsUseProbeShapes = false;
FAutoConsoleVariableRef CVarCCDSweepsUseProbeShapes(TEXT("p.Chaos.CCD.CCDSweepsUseProbeShapes"), bCCDSweepsUseProbeShapes , TEXT("When true, probe shapes can be swept for more accurate collision detection."));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/GeometryParticles.h:31
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
namespace CVars
{
CHAOS_API extern int32 CCDAxisThresholdMode;
CHAOS_API extern bool bCCDAxisThresholdUsesProbeShapes;
}
namespace Private
{
class FPBDIslandParticle;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/GeometryParticles.h:333
Scope (from outer to inner):
file
namespace Chaos
class class TGeometryParticlesImp : public TSimpleGeometryParticles<T, d>
function void UpdateCCDAxisThreshold
Source code excerpt:
}
if (CVars::CCDAxisThresholdMode == 0)
{
// Use object extents as CCD axis threshold
MCCDAxisThreshold[Index] = MLocalBounds[Index].Extents();
}
else if (CVars::CCDAxisThresholdMode == 1)
{
// Use thinnest object extents as all axis CCD thresholds
MCCDAxisThreshold[Index] = FVec3(MLocalBounds[Index].Extents().GetMin());
}
else
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/GeometryParticles.h:367
Scope (from outer to inner):
file
namespace Chaos
class class TGeometryParticlesImp : public TSimpleGeometryParticles<T, d>
function void UpdateCCDAxisThreshold
Source code excerpt:
}
if (CVars::CCDAxisThresholdMode == 2)
{
// On each axis, use the thinnest shape bound on that axis
MCCDAxisThreshold[Index] = ThinnestBoundsPerAxis;
}
else if (CVars::CCDAxisThresholdMode == 3)
{
// Find the thinnest shape bound on any axis and use this for all axes
MCCDAxisThreshold[Index] = FVec3(ThinnestBoundsPerAxis.GetMin());
}
}
}