p.Chaos.Collision.EdgePrunePlaneDistance
p.Chaos.Collision.EdgePrunePlaneDistance
#Overview
name: p.Chaos.Collision.EdgePrunePlaneDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.EdgePrunePlaneDistance is to control the edge pruning distance for collision detection in the Chaos physics system of Unreal Engine 5. This setting is specifically used in the collision detection process for trimesh and heightfield contacts.
This setting variable is primarily used in the Chaos physics subsystem, which is part of the Experimental module in Unreal Engine 5. It’s referenced in various collision-related files within the Chaos namespace.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 3.0 and can be modified at runtime using the console command.
The associated variable Chaos_Collision_EdgePrunePlaneDistance interacts directly with p.Chaos.Collision.EdgePrunePlaneDistance. They share the same value, with Chaos_Collision_EdgePrunePlaneDistance being the actual variable used in the code.
Developers should be aware that this variable affects the precision of collision detection, particularly for edge cases in trimesh and heightfield collisions. Adjusting this value can impact performance and accuracy of physics simulations.
Best practices when using this variable include:
- Be cautious when modifying it, as it can significantly affect collision behavior.
- Test thoroughly after any changes to ensure desired physics behavior is maintained.
- Consider the scale of your objects when adjusting this value, as it’s scaled based on object size.
Regarding the associated variable Chaos_Collision_EdgePrunePlaneDistance:
- It’s used directly in collision pruning calculations.
- It’s scaled based on the size of the colliding objects (100cm is considered a unit size).
- It’s used in multiple collision-related functions, including edge plane tolerance calculations and contact group pruning.
- Developers should note that this variable is used in performance-critical code paths, so any modifications should be carefully profiled.
#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:83
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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
FAutoConsoleVariableRef CVarChaos_Collision_MeshContactNormalThreshold(TEXT("p.Chaos.Collision.MeshContactNormalThreshold"), Chaos_Collision_MeshContactNormalThreshold, TEXT("Treat contact with a dot product between the normal and the triangle face greater than this as face collisions"));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_EdgePrunePlaneDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/CollisionPruning.cpp:13
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
namespace Chaos
{
extern FRealSingle Chaos_Collision_EdgePrunePlaneDistance;
inline FReal CalculateEdgePlaneTolarance(const FGeometryParticleHandle* Particle)
{
// Chaos_Collision_EdgePrunePlaneDistance is prune distance for unit sized object (100cm) so scale to the size of this object
const FReal EdgePlaneTolerancePerCm = FReal(Chaos_Collision_EdgePrunePlaneDistance) * FReal(0.01);
const FReal ParticleSize = Particle->HasBounds() ? Particle->LocalBounds().Extents().Min() : FReal(1);
const FReal EdgePlaneTolerance = ParticleSize * EdgePlaneTolerancePerCm;
return EdgePlaneTolerance;
}
inline FReal CalculateEdgePointBarycentricTolarance(const FGeometryParticleHandle* Particle)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/CollisionPruning.cpp:450
Scope (from outer to inner):
file
namespace Chaos
function void FParticleSubSurfaceCollisionPruner::Prune
Source code excerpt:
void FParticleSubSurfaceCollisionPruner::Prune(const FVec3& UpVector)
{
// Chaos_Collision_EdgePrunePlaneDistance is prune distance for unit sized object (100cm) so scale by size of this object
const FReal PlaneDistanceTolerancePerCm = FReal(Chaos_Collision_EdgePrunePlaneDistance) * FReal(0.01);
const FReal PlaneDistanceSize = Particle->HasBounds() ? Particle->LocalBounds().Extents().Min() : FReal(1);
const FReal PlaneDistanceTolerance = PlaneDistanceSize * PlaneDistanceTolerancePerCm;
const FReal PlaneNormalTolerance = FReal(0.95);
FContactGroupContainer ContactGroupContainer(UpVector);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:81
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
FAutoConsoleVariableRef CVarChaos_Collision_MeshContactNormalThreshold(TEXT("p.Chaos.Collision.MeshContactNormalThreshold"), Chaos_Collision_MeshContactNormalThreshold, TEXT("Treat contact with a dot product between the normal and the triangle face greater than this as face collisions"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/HeightField.cpp:28
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
}
extern FRealSingle Chaos_Collision_EdgePrunePlaneDistance;
extern bool bChaos_Collision_OneSidedHeightField;
class FHeightfieldRaycastVisitor
{
public:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/TriangleMeshImplicitObject.cpp:23
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
}
extern FRealSingle Chaos_Collision_EdgePrunePlaneDistance;
// Note that if this is re-enabled when previously off, the cooked trimeshes won't have the vertex map serialized, so the change will not take effect until re-cooked.
bool TriMeshPerPolySupport = 1;
FAutoConsoleVariableRef CVarPerPolySupport(TEXT("p.Chaos.TriMeshPerPolySupport"), TriMeshPerPolySupport, TEXT("Disabling removes memory cost of vertex map on triangle mesh. Note: Changing at runtime will not work."));
FReal GetWindingOrder(const FVec3& Scale)