p.Chaos.Collision.MaxShapePairs
p.Chaos.Collision.MaxShapePairs
#Overview
name: p.Chaos.Collision.MaxShapePairs
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.MaxShapePairs is to control the maximum number of shape pairs allowed in the Chaos physics engine’s collision detection system before switching to a more generic version of collision detection.
This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s experimental physics system. Specifically, it’s used in the collision detection subsystem, particularly in the mid-phase collision detection process.
The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.
This variable interacts closely with another variable named Chaos_Collision_MidPhase_MaxShapePairs. They share the same value, with p.Chaos.Collision.MaxShapePairs being the console-accessible name and Chaos_Collision_MidPhase_MaxShapePairs being the C++ variable used in the code.
Developers must be aware that this variable affects the performance and behavior of collision detection in the Chaos physics system. If the number of shape pairs exceeds this value, the system will switch to a more generic (and potentially slower) collision detection method.
Best practices when using this variable include:
- Carefully tuning its value based on the specific needs of your game or simulation.
- Monitoring performance impacts when adjusting this value.
- Consider the trade-off between performance and accuracy when setting this value.
Regarding the associated variable Chaos_Collision_MidPhase_MaxShapePairs:
The purpose of Chaos_Collision_MidPhase_MaxShapePairs is to store the actual value used in the C++ code for the maximum number of shape pairs in the mid-phase collision detection.
This variable is used directly in the Chaos physics engine’s collision detection system, specifically in the ParticlePairMidPhase.cpp file.
Its value is set by the console variable p.Chaos.Collision.MaxShapePairs, as they are linked through the FAutoConsoleVariableRef system.
This variable interacts with the boolean variable bTooManyImplicitPairs, which is used to determine if the number of implicit pairs exceeds the maximum allowed.
Developers should be aware that this variable directly impacts the behavior of the CalculateMidPhaseType function in the FParticlePairMidPhase class.
Best practices include ensuring that any changes to p.Chaos.Collision.MaxShapePairs are reflected in the behavior of functions using Chaos_Collision_MidPhase_MaxShapePairs, and vice versa.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:60
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 Chaos_Collision_MidPhase_MaxShapePairs = 100;
FAutoConsoleVariableRef CVarChaos_Collision_EnableShapePairs(TEXT("p.Chaos.Collision.EnableShapePairs"), bChaos_Collision_MidPhase_EnableShapePairs, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_MaxShapePairs(TEXT("p.Chaos.Collision.MaxShapePairs"), Chaos_Collision_MidPhase_MaxShapePairs, TEXT(""));
extern int32 ChaosOneWayInteractionPairCollisionMode;
extern bool bChaosForceMACD;
}
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_MidPhase_MaxShapePairs
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:58
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// with only a small number implicit objects each. If so, how many shape pairs do we allow before switching to the generic version?
bool bChaos_Collision_MidPhase_EnableShapePairs = true;
int32 Chaos_Collision_MidPhase_MaxShapePairs = 100;
FAutoConsoleVariableRef CVarChaos_Collision_EnableShapePairs(TEXT("p.Chaos.Collision.EnableShapePairs"), bChaos_Collision_MidPhase_EnableShapePairs, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_MaxShapePairs(TEXT("p.Chaos.Collision.MaxShapePairs"), Chaos_Collision_MidPhase_MaxShapePairs, TEXT(""));
extern int32 ChaosOneWayInteractionPairCollisionMode;
extern bool bChaosForceMACD;
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:768
Scope (from outer to inner):
file
namespace Chaos
function EParticlePairMidPhaseType FParticlePairMidPhase::CalculateMidPhaseType
Source code excerpt:
// Are there too many implicits for the flattened shape pair path to be optimal?
const int32 MaxImplicitPairs = CVars::Chaos_Collision_MidPhase_MaxShapePairs;
const bool bTooManyImplicitPairs = (MaxImplicitPairs > 0) && (NumImplicits0 * NumImplicits1 > MaxImplicitPairs);
// Is either of the implicits a Union of Unions?
const bool bIsTree = bIsTree0 || bIsTree1;
const bool bCanPrebuildShapePairs = !bTooManyImplicitPairs && !bIsTree;