p.Chaos.CCD.CCDAxisThresholdUsesProbeShapes

p.Chaos.CCD.CCDAxisThresholdUsesProbeShapes

#Overview

name: p.Chaos.CCD.CCDAxisThresholdUsesProbeShapes

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.CCD.CCDAxisThresholdUsesProbeShapes is to control whether probe shapes are considered for Continuous Collision Detection (CCD) axis threshold computation and contact generation in the initial CCD phase within 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 (Continuous Collision Detection) subsystem within Chaos.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files. It is initialized as a boolean variable with a default value of false.

The associated variable bCCDAxisThresholdUsesProbeShapes interacts directly with this console variable. They share the same value and purpose within the codebase.

Developers must be aware that enabling this variable will include probe shapes in the CCD axis threshold computation, which can potentially generate contacts in the initial CCD phase. This may increase the accuracy of collision detection but could also impact performance.

Best practices when using this variable include:

  1. Only enable it when increased accuracy for probe shapes in CCD is necessary for your specific use case.
  2. Monitor performance impact when enabling this feature, especially in scenes with many dynamic objects.
  3. Consider using it in conjunction with other CCD-related settings for optimal results.
  4. Test thoroughly in various scenarios to ensure it doesn’t introduce unexpected behavior in your game’s physics simulations.

Regarding the associated variable bCCDAxisThresholdUsesProbeShapes:

This variable is used directly in the UpdateCCDAxisThreshold function of the TGeometryParticlesImp class. When true, it allows probe shapes to be considered when calculating the CCD axis threshold for each particle’s geometry. This can lead to more accurate collision detection for probe shapes but may increase computational overhead.

Developers should be aware that this variable affects the behavior of the physics simulation at a low level and should be used cautiously. It’s important to balance the need for accurate probe shape collision detection with performance considerations, especially in scenes with many dynamic objects or complex geometries.

#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:48

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		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."));

		// How many post-solve CCD correction iterations to run
		int32 ChaosCollisionCCDCorrectionIterations = 4;

#Associated Variable and Callsites

This variable is associated with another variable named bCCDAxisThresholdUsesProbeShapes. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CCDUtilities.cpp:47

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		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."));

		// How many post-solve CCD correction iterations to run
		int32 ChaosCollisionCCDCorrectionIterations = 4;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/GeometryParticles.h:32

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

	{
		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:352

Scope (from outer to inner):

file
namespace    Chaos
class        class TGeometryParticlesImp : public TSimpleGeometryParticles<T, d>
function     void UpdateCCDAxisThreshold

Source code excerpt:

					// sim-enabled flag is on for each shape before considering it's min bounds
					// for CCD extents.
					if (Shape->GetSimEnabled() && (CVars::bCCDAxisThresholdUsesProbeShapes || !Shape->GetIsProbe()))
					{
						const FImplicitObjectRef Geometry = Shape->GetGeometry();
						if (Geometry && Geometry->HasBoundingBox())
						{
							const TVector<T, d> ShapeExtents = Geometry->BoundingBox().Extents();
							TVector<T, d>& CCDAxisThreshold = MCCDAxisThreshold[Index];