p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon
p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon
#Overview
name: p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Normal tolerance used to distinguish face contacts from edge-edge contacts
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon is to define a normal tolerance used to distinguish face contacts from edge-edge contacts in collision detection within the Chaos physics system of Unreal Engine 5.
This setting variable is primarily used by the Chaos physics subsystem, specifically in the collision detection and manifold generation components. It’s part of the experimental Chaos physics engine in Unreal Engine 5.
The value of this variable is set to 0.001f by default, as seen in the source code. It’s defined using FAutoConsoleVariableRef, which means it can be modified at runtime through the console or configuration files.
The associated variable Chaos_Collision_Manifold_PlaneContactNormalEpsilon directly interacts with p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the precision of collision detection, particularly in distinguishing between face contacts and edge-edge contacts. Modifying this value could impact the accuracy and performance of collision detection in the physics simulation.
Best practices when using this variable include:
- Only modify it if you fully understand the implications on collision detection accuracy.
- Test thoroughly after any modifications to ensure desired physics behavior.
- Consider performance impacts when adjusting the value, as increased precision may come at a computational cost.
Regarding the associated variable Chaos_Collision_Manifold_PlaneContactNormalEpsilon:
This variable is used directly in the collision detection code to determine if a contact is a plane contact or an edge-edge contact. It’s used in functions like ConstructConvexConvexOneShotManifold, ConstructCapsuleConvexOneShotManifold, and ConstructPlanarConvexTriangleOneShotManifold.
The variable is compared against the dot product of normal vectors to classify contact types. For example, in the ConstructConvexConvexOneShotManifold function, it’s used like this:
const bool bIsPlaneContact = FMath::IsNearlyEqual(BestPlaneDotNormalConvex1, (FReal)1., PlaneContactNormalEpsilon) || FMath::IsNearlyEqual(BestPlaneDotNormalConvex2, (FReal)1., PlaneContactNormalEpsilon);
This classification affects how the collision is resolved, so any changes to this variable could have significant effects on the physics simulation’s behavior.
#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:41
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle Chaos_Collision_Manifold_PlaneContactNormalEpsilon = 0.001f;
FAutoConsoleVariableRef CVarChaos_Manifold_PlaneContactNormalEpsilon(TEXT("p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon"), Chaos_Collision_Manifold_PlaneContactNormalEpsilon, TEXT("Normal tolerance used to distinguish face contacts from edge-edge contacts"));
FRealSingle Chaos_Collision_Manifold_TriangleContactNormalThreshold = 0.75f; // About 40deg
FAutoConsoleVariableRef CVarChaos_Manifold_TriangleContactNormalThreshold(TEXT("p.Chaos.Collision.Manifold.TriangleNormalThreshold"), Chaos_Collision_Manifold_TriangleContactNormalThreshold, TEXT(""));
FRealSingle Chaos_Collision_Manifold_EdgeContactNormalThreshold = 0.9f; // About 25deg
FAutoConsoleVariableRef CVarChaos_Manifold_EdgeContactNormalThreshold(TEXT("p.Chaos.Collision.Manifold.EdgeNormalThreshold"), Chaos_Collision_Manifold_EdgeContactNormalThreshold, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_Manifold_PlaneContactNormalEpsilon
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:40
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarChaos_Manifold_CapsuleMinContactDistanceFraction(TEXT("p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction"), Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction, TEXT(""));
FRealSingle Chaos_Collision_Manifold_PlaneContactNormalEpsilon = 0.001f;
FAutoConsoleVariableRef CVarChaos_Manifold_PlaneContactNormalEpsilon(TEXT("p.Chaos.Collision.Manifold.PlaneContactNormalEpsilon"), Chaos_Collision_Manifold_PlaneContactNormalEpsilon, TEXT("Normal tolerance used to distinguish face contacts from edge-edge contacts"));
FRealSingle Chaos_Collision_Manifold_TriangleContactNormalThreshold = 0.75f; // About 40deg
FAutoConsoleVariableRef CVarChaos_Manifold_TriangleContactNormalThreshold(TEXT("p.Chaos.Collision.Manifold.TriangleNormalThreshold"), Chaos_Collision_Manifold_TriangleContactNormalThreshold, TEXT(""));
FRealSingle Chaos_Collision_Manifold_EdgeContactNormalThreshold = 0.9f; // About 25deg
FAutoConsoleVariableRef CVarChaos_Manifold_EdgeContactNormalThreshold(TEXT("p.Chaos.Collision.Manifold.EdgeNormalThreshold"), Chaos_Collision_Manifold_EdgeContactNormalThreshold, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:876
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void ConstructConvexConvexOneShotManifold
Source code excerpt:
// Is this a vertex-plane or edge-edge contact?
const FReal PlaneContactNormalEpsilon = Chaos_Collision_Manifold_PlaneContactNormalEpsilon;
const bool bIsPlaneContact = FMath::IsNearlyEqual(BestPlaneDotNormalConvex1, (FReal)1., PlaneContactNormalEpsilon) || FMath::IsNearlyEqual(BestPlaneDotNormalConvex2, (FReal)1., PlaneContactNormalEpsilon);
// For edge-edge contacts, we find the edges involved and project the contact onto the edges (if necessary - see below)
if (!bIsPlaneContact)
{
if (ForceOneShotManifoldEdgeEdgeCaseZeroCullDistance && GJKContactPoint.Phi > 0)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:1106
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void ConstructCapsuleConvexOneShotManifold
Source code excerpt:
Convex.GetPlaneNX(ConvexPlaneIndex, ConvexPlaneNormal, ConvexPlanePosition);
const FReal ConvexPlaneNormalDotContactNormal = FVec3::DotProduct(ConvexPlaneNormal, GJKContactPoint.ShapeContactNormal);
const FReal PlaneContactNormalEpsilon = Chaos_Collision_Manifold_PlaneContactNormalEpsilon;
bool bIsConvexPlaneContact = FMath::IsNearlyEqual(ConvexPlaneNormalDotContactNormal, FReal(-1), PlaneContactNormalEpsilon);
if (bIsCapsuleCylinderContact)
{
// Cylinder plane most opposing GJK result direction
const FVec3 CapsulePlaneNormal = -(GJKContactPoint.ShapeContactNormal - CapsuleAxisDotNormal * CapsuleAxisSegment.GetAxis()).GetSafeNormal();
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:1306
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void ConstructPlanarConvexTriangleOneShotManifold
Source code excerpt:
// Is either plane a good choice, or do we have and edge-edge collision
// For edge-edge contacts, we find the edges involved and project the contact onto the edges (if necessary - see below)
const FReal PlaneContactNormalEpsilon = Chaos_Collision_Manifold_PlaneContactNormalEpsilon;
bool bIsPlaneContact = FMath::IsNearlyEqual(ConvexPlaneNormalDotContactNormal, FReal(-1), PlaneContactNormalEpsilon) || FMath::IsNearlyEqual(TrianglePlaneNormalDotContactNormal, FReal(1), PlaneContactNormalEpsilon);
if (!bIsPlaneContact)
{
if (ForceOneShotManifoldEdgeEdgeCaseZeroCullDistance && GJKContactPoint.Phi > 0)
{
return;