p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction
p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction
#Overview
name: p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction
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.CapsuleMinContactDistanceFraction
is to control the minimum distance between contact points in capsule-convex collision detection within the Chaos physics system of Unreal Engine 5. It is used to ignore one of the contacts when two contact points are closer together than this fraction of the capsule’s radius.
This setting variable is primarily used by the Chaos physics system, which is part of Unreal Engine’s experimental features. Specifically, it is used in the collision detection and manifold generation subsystem of Chaos.
The value of this variable is set in the C++ code, initialized to 0.1f. It can be modified at runtime through the Unreal Engine console system, as it is registered as an auto console variable.
The associated variable Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction
directly interacts with this setting. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the precision and performance of capsule-convex collision detection. A smaller value will result in more precise contact manifolds but may increase computational cost, while a larger value might improve performance at the cost of some precision.
Best practices when using this variable include:
- Only modify it if you understand the implications on collision detection accuracy and performance.
- Test thoroughly after changing the value to ensure it doesn’t negatively impact your game’s physics behavior.
- Consider exposing this setting in your game’s advanced options if you want to allow users to fine-tune physics performance.
Regarding the associated variable Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction
:
The purpose of this variable is the same as p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction
. It’s used internally in the Chaos physics system to represent the minimum contact distance fraction for capsule-convex collisions.
This variable is used directly in the ConstructCapsuleConvexOneShotManifold
function within the Chaos collision system. It determines the threshold for considering two contact points as distinct or merged.
The value of this variable is set by the console variable p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction
.
Developers should be aware that modifying the console variable will directly affect this internal variable. When debugging or profiling capsule-convex collisions, this variable can be a key factor in understanding how contact points are being generated and culled.
Best practices include monitoring this variable’s impact on collision behavior and performance, especially in scenarios with many capsule-convex interactions. If issues arise with capsule-convex collisions, this variable might be a good starting point for investigation and potential optimization.
#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:38
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// When a capsule-convex contact has points closer together than this fraction of radius, ignore one of the contacts
FRealSingle Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction = 0.1f;
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(""));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:37
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// When a capsule-convex contact has points closer together than this fraction of radius, ignore one of the contacts
FRealSingle Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction = 0.1f;
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(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:1192
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void ConstructCapsuleConvexOneShotManifold
Source code excerpt:
PlaneTolerance);
const FReal PointDistanceToleranceFraction = Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction;
const FReal PointDistanceToleranceSq = FMath::Square(PointDistanceToleranceFraction * CapsuleRadius);
// Add the vertices if not clipped away
for (int32 ContactPointIndex = 0; ContactPointIndex < ContactPointCount; ++ContactPointIndex)
{
// Don't add the point if it's very close to the GJK result because we're adding that too below