p.Chaos.Collision.Manifold.EdgeNormalThreshold
p.Chaos.Collision.Manifold.EdgeNormalThreshold
#Overview
name: p.Chaos.Collision.Manifold.EdgeNormalThreshold
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.Manifold.EdgeNormalThreshold is to define a threshold for determining whether a contact point between two colliding objects should be considered a plane contact or an edge contact in the Chaos physics engine. This setting is crucial for the collision detection and response system within Unreal Engine’s physics simulation.
This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s experimental physics system. It’s specifically utilized in the collision manifold generation process, which is a key component of the physics simulation.
The value of this variable is set to 0.9f by default, which corresponds to an angle of about 25 degrees. It’s defined in the Chaos namespace within the CollisionOneShotManifolds.cpp file.
The associated variable Chaos_Collision_Manifold_EdgeContactNormalThreshold interacts directly with p.Chaos.Collision.Manifold.EdgeNormalThreshold. They share the same value and are used interchangeably in the code.
Developers must be aware that this threshold significantly affects how collision contacts are classified and subsequently handled by the physics engine. A higher threshold will result in more contacts being classified as edge contacts, while a lower threshold will lead to more plane contacts.
Best practices when using this variable include:
- Carefully adjusting the value based on the specific needs of your simulation.
- Testing thoroughly after any changes, as it can significantly impact physics behavior.
- Considering the performance implications, as different contact classifications may affect computational load.
Regarding the associated variable Chaos_Collision_Manifold_EdgeContactNormalThreshold:
- Its purpose is identical to p.Chaos.Collision.Manifold.EdgeNormalThreshold.
- It’s used directly in the collision detection code to determine if a contact is a plane contact.
- The value is set through the console variable system, allowing for runtime adjustments.
- It’s used in the ConstructPlanarConvexTriangleOneShotManifold function to classify contacts between convex shapes and triangles.
- Developers should be aware that changes to this variable will immediately affect ongoing physics simulations.
- Best practices include logging or displaying this value during development to ensure it’s set as expected, and considering its impact on both accuracy and performance of the physics simulation.
#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:47
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle Chaos_Collision_Manifold_EdgeContactNormalThreshold = 0.9f; // About 25deg
FAutoConsoleVariableRef CVarChaos_Manifold_EdgeContactNormalThreshold(TEXT("p.Chaos.Collision.Manifold.EdgeNormalThreshold"), Chaos_Collision_Manifold_EdgeContactNormalThreshold, TEXT(""));
// We use a smaller margin for triangle to convex. Ideally we would have none at all in this case
// LWC_TODO: This needs to be a larger value for float builds (probably 1)
FRealSingle Chaos_Collision_Manifold_TriangleConvexMarginMultiplier = 0.5f;
FAutoConsoleVariableRef CVarChaos_Manifold_TriangleConvexMarginMultipler(TEXT("p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier"), Chaos_Collision_Manifold_TriangleConvexMarginMultiplier, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_Manifold_EdgeContactNormalThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:46
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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(""));
// We use a smaller margin for triangle to convex. Ideally we would have none at all in this case
// LWC_TODO: This needs to be a larger value for float builds (probably 1)
FRealSingle Chaos_Collision_Manifold_TriangleConvexMarginMultiplier = 0.5f;
FAutoConsoleVariableRef CVarChaos_Manifold_TriangleConvexMarginMultipler(TEXT("p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier"), Chaos_Collision_Manifold_TriangleConvexMarginMultiplier, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:1332
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void ConstructPlanarConvexTriangleOneShotManifold
Source code excerpt:
const FVec3 EdgeNormal = FVec3::CrossProduct(ConvexEdgePos1 - ConvexEdgePos0, TriangleEdgePos1 - TriangleEdgePos0).GetSafeNormal();
const FReal EdgeNormalDotContactNormal = FVec3::DotProduct(EdgeNormal, GJKContactPoint.ShapeContactNormal);
bIsPlaneContact = (FMath::Abs(EdgeNormalDotContactNormal) < Chaos_Collision_Manifold_EdgeContactNormalThreshold);
if (!bIsPlaneContact)
{
const FReal EdgePhi = FVec3::DotProduct(ConvexEdgeNearPos - TriangleEdgeNearPos, GJKContactPoint.ShapeContactNormal);
// We now have an accurate separation, so reject points beyond cull distance.