p.Chaos.Collision.EnableEdgePrune
p.Chaos.Collision.EnableEdgePrune
#Overview
name: p.Chaos.Collision.EnableEdgePrune
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.EnableEdgePrune is to control whether spurious edge contacts in trimesh and heightfield collisions are pruned. This setting is part of the Chaos physics system in Unreal Engine 5, specifically related to collision detection and handling.
This setting variable is primarily used in the Chaos physics subsystem, which is part of the Experimental module in Unreal Engine 5. It’s specifically utilized in collision detection and contact point generation for complex geometries like trimeshes and heightfields.
The value of this variable is set through an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files. By default, it is set to true.
The associated variable bChaos_Collision_EnableEdgePrune directly interacts with p.Chaos.Collision.EnableEdgePrune. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable significantly impacts the accuracy and performance of collision detection for complex geometries. When enabled, it helps to remove invalid edge or vertex contacts, which can improve the stability and realism of physics simulations.
Best practices when using this variable include:
- Keeping it enabled for most scenarios, as it’s described as “pretty much essential” in the comments.
- Only disabling it if specific collision issues arise that might be related to over-aggressive edge pruning.
- Monitoring performance and simulation quality when modifying this setting, as it can have far-reaching effects on physics behavior.
Regarding the associated variable bChaos_Collision_EnableEdgePrune:
The purpose of bChaos_Collision_EnableEdgePrune is the same as p.Chaos.Collision.EnableEdgePrune - to control edge pruning in collision detection.
It’s used directly in the collision detection code, specifically in the FContactTriangleCollector::PruneEdgeAndVertexContactPoints function. This function is part of the contact point generation process for complex geometries.
The value is set in the same place as p.Chaos.Collision.EnableEdgePrune, through the FAutoConsoleVariableRef.
This variable directly controls the execution of the edge pruning algorithm. When false, the pruning function returns immediately without performing any pruning.
Developers should be aware that this variable has a direct and immediate effect on collision detection behavior. Disabling it could lead to more numerous but potentially less accurate collision contacts.
Best practices for bChaos_Collision_EnableEdgePrune are the same as for p.Chaos.Collision.EnableEdgePrune, given they are effectively the same variable used in different contexts within the code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:82
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
bool bChaos_Collision_EnableEdgePrune = true;
FRealSingle Chaos_Collision_EdgePrunePlaneDistance = 3.0;
FAutoConsoleVariableRef CVarChaos_Collision_EnableEdgePrune(TEXT("p.Chaos.Collision.EnableEdgePrune"), bChaos_Collision_EnableEdgePrune, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_EdgePrunePlaneDistance(TEXT("p.Chaos.Collision.EdgePrunePlaneDistance"), Chaos_Collision_EdgePrunePlaneDistance, TEXT(""));
bool bChaos_Collision_EnableLargeMeshManifolds = 1;
FAutoConsoleVariableRef CVarChaos_Collision_EnableLargeMeshManifolds(TEXT("p.Chaos.Collision.EnableLargeMeshManifolds"), bChaos_Collision_EnableLargeMeshManifolds, TEXT("Whether to allow large mesh manifolds for collisions against meshes (required for good behaviour)"));
FRealSingle Chaos_Collision_MeshContactNormalThreshold = 0.998f; // ~3deg
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_Collision_EnableEdgePrune
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ContactTriangles.cpp:8
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
extern int32 ChaosSolverDebugDrawMeshContacts;
}
extern bool bChaos_Collision_EnableEdgePrune;
extern bool bChaos_Collision_EnableLargeMeshManifolds;
extern FRealSingle Chaos_Collision_MeshContactNormalThreshold;
extern bool bChaos_Collision_MeshManifoldSortByDistance;
void FContactTriangleCollector::SetNumContacts(const int32 NumContacts)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ContactTriangles.cpp:367
Scope (from outer to inner):
file
namespace Chaos
function void FContactTriangleCollector::PruneEdgeAndVertexContactPoints
Source code excerpt:
void FContactTriangleCollector::PruneEdgeAndVertexContactPoints(const bool bPruneEdges, const bool bPruneVertices)
{
if (!bChaos_Collision_EnableEdgePrune)
{
return;
}
// Remove contacts that are invalid edge or vertex contacts
// - vertex collisions if we have an edge collision that includes the vertex
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:80
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// Whether to prune spurious edge contacts in trimesh and heighfield contacts (pretty much essential)
bool bChaos_Collision_EnableEdgePrune = true;
FRealSingle Chaos_Collision_EdgePrunePlaneDistance = 3.0;
FAutoConsoleVariableRef CVarChaos_Collision_EnableEdgePrune(TEXT("p.Chaos.Collision.EnableEdgePrune"), bChaos_Collision_EnableEdgePrune, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_EdgePrunePlaneDistance(TEXT("p.Chaos.Collision.EdgePrunePlaneDistance"), Chaos_Collision_EdgePrunePlaneDistance, TEXT(""));
bool bChaos_Collision_EnableLargeMeshManifolds = 1;
FAutoConsoleVariableRef CVarChaos_Collision_EnableLargeMeshManifolds(TEXT("p.Chaos.Collision.EnableLargeMeshManifolds"), bChaos_Collision_EnableLargeMeshManifolds, TEXT("Whether to allow large mesh manifolds for collisions against meshes (required for good behaviour)"));
FRealSingle Chaos_Collision_MeshContactNormalThreshold = 0.998f; // ~3deg