p.Chaos.Collision.EPAEpsilon
p.Chaos.Collision.EPAEpsilon
#Overview
name: p.Chaos.Collision.EPAEpsilon
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.EPAEpsilon is to set the epsilon value for the Expanding Polytope Algorithm (EPA) used in collision detection within the Chaos physics system of Unreal Engine 5. This epsilon value determines the tolerance for the EPA algorithm, which is used to calculate the penetration depth and contact points between colliding objects.
The Chaos physics system, which is part of Unreal Engine’s experimental features, relies on this setting variable. Specifically, it is used in the collision detection and contact point generation subsystems.
The value of this variable is set in the C++ code, initially defined as 1.e-6f. It is then exposed as a console variable using FAutoConsoleVariableRef, allowing it to be modified at runtime or through configuration files.
This variable interacts closely with another variable named Chaos_Collision_EPAEpsilon. They share the same value and are used interchangeably in the code.
Developers must be aware that this epsilon value directly affects the precision of collision detection. A smaller value may increase accuracy but could potentially impact performance, while a larger value might improve performance at the cost of some precision.
Best practices when using this variable include:
- Carefully adjusting the value based on the specific needs of your project, balancing between accuracy and performance.
- Testing thoroughly after any changes to ensure desired collision behavior.
- Considering the relationship between this variable and Chaos_Collision_GJKEpsilon, as they are often used together in collision calculations.
Regarding the associated variable Chaos_Collision_EPAEpsilon:
The purpose of Chaos_Collision_EPAEpsilon is the same as p.Chaos.Collision.EPAEpsilon. It is the internal representation of the EPA epsilon value within the Chaos physics system.
This variable is used directly in the collision detection algorithms, particularly in the GJKPenetrationSameSpace function and other related collision functions.
The value of Chaos_Collision_EPAEpsilon is set to match p.Chaos.Collision.EPAEpsilon, allowing for consistency between the console-accessible variable and the internal implementation.
Chaos_Collision_EPAEpsilon interacts closely with Chaos_Collision_GJKEpsilon, as both are used in tandem for collision calculations.
Developers should be aware that modifying p.Chaos.Collision.EPAEpsilon will directly affect Chaos_Collision_EPAEpsilon, and thus the behavior of the collision system.
Best practices for Chaos_Collision_EPAEpsilon include ensuring that any code that directly uses this variable is updated if changes are made to the epsilon value, and considering the impact on both GJK and EPA algorithms when adjusting this value.
#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:77
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle Chaos_Collision_EPAEpsilon = 1.e-6f;
FAutoConsoleVariableRef CVarChaos_Collision_GJKEpsilon(TEXT("p.Chaos.Collision.GJKEpsilon"), Chaos_Collision_GJKEpsilon, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_EPAEpsilon(TEXT("p.Chaos.Collision.EPAEpsilon"), Chaos_Collision_EPAEpsilon, TEXT(""));
// 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(""));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_EPAEpsilon
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ConvexTriangleContactPoint.cpp:21
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
{
extern FRealSingle Chaos_Collision_GJKEpsilon;
extern FRealSingle Chaos_Collision_EPAEpsilon;
// Check whether the convex-triangle edge pair form part of the Minkowski Sum. Only edge pairs
// that contribute to the Minkowki Sum surface need to be checked for separation. The inputs
// are the convex normals for the two faces that share the convex edge, and the normal and
// edge vector of the triangle.
//
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ConvexTriangleContactPoint.cpp:778
Scope (from outer to inner):
file
namespace Chaos::Private
function bool ConvexTriangleContactPoint
Source code excerpt:
FVec3 ConvexClosest, TriangleClosest, ConvexNormal;
const FReal GJKEpsilon = Chaos_Collision_GJKEpsilon;
const FReal EPAEpsilon = Chaos_Collision_EPAEpsilon;
FVec3 InitialGJKDir = FVec3(1, 0, 0);
const bool bHaveContact = GJKPenetrationSameSpace(
GJKConvex,
GJKTriangle,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:75
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// LWC_TODO: These needs to be a larger values for float builds (1.e-3f)
FRealSingle Chaos_Collision_GJKEpsilon = 1.e-6f;
FRealSingle Chaos_Collision_EPAEpsilon = 1.e-6f;
FAutoConsoleVariableRef CVarChaos_Collision_GJKEpsilon(TEXT("p.Chaos.Collision.GJKEpsilon"), Chaos_Collision_GJKEpsilon, TEXT(""));
FAutoConsoleVariableRef CVarChaos_Collision_EPAEpsilon(TEXT("p.Chaos.Collision.EPAEpsilon"), Chaos_Collision_EPAEpsilon, TEXT(""));
// 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(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:508
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function FContactPoint GJKContactPointMargin
Source code excerpt:
//const FReal Epsilon = 3.e-3f; // original value for float implementation
const FReal GJKEpsilon = Chaos_Collision_GJKEpsilon;
const FReal EPAEpsilon = Chaos_Collision_EPAEpsilon;
const TGJKCoreShape<GeometryA> AWithMargin(A, MarginA);
const TGJKCoreShape<GeometryB> BWithMargin(B, MarginB);
bool bHaveContact = false;
if (bChaos_Collision_UseGJK2)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:548
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function FContactPoint GJKContactPointSameSpace
Source code excerpt:
// GJK and EPA tolerances. See comments in GJKContactPointMargin
const FReal GJKEpsilon = Chaos_Collision_GJKEpsilon;
const FReal EPAEpsilon = Chaos_Collision_EPAEpsilon;
bool bHaveContact = false;
if (bChaos_Collision_UseGJK2)
{
bHaveContact = GJKPenetrationSameSpace2(A, B, Penetration, ClosestA, ClosestB, Normal, VertexIndexA, VertexIndexB, OutMaxMarginDelta, InitialGJKDir, GJKEpsilon, EPAEpsilon);
}