p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier
p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier
#Overview
name: p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier
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.TriangleConvexMarginMultiplier is to adjust the margin multiplier for triangle-convex collisions in the Chaos physics system. It is specifically used to set a smaller margin for triangle to convex collisions, which ideally would have no margin at all.
This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics framework. It’s specifically utilized in the collision detection and manifold generation processes for triangle-convex shape interactions.
The value of this variable is set in the Chaos namespace within the CollisionOneShotManifolds.cpp file. It’s initialized with a default value of 0.5f and is then exposed as a console variable, allowing it to be modified at runtime.
The variable interacts directly with Chaos_Collision_Manifold_TriangleConvexMarginMultiplier, which shares the same value. This associated variable is used in the actual collision calculations, specifically in the ConstructPlanarConvexTriangleOneShotManifold function.
Developers must be aware that this variable directly affects the precision of triangle-convex collision detection. A smaller value (closer to 0) will result in more precise collisions but may lead to more computational overhead or potential instabilities. A larger value will be more performant but less accurate.
Best practices when using this variable include:
- Carefully tuning it based on the specific needs of your project, balancing between accuracy and performance.
- Testing thoroughly with different values to ensure stability across various collision scenarios.
- Being aware that changing this value may require adjustments to other collision-related parameters for optimal results.
- Noting the TODO comment suggesting that this value might need to be larger (probably 1) for float builds.
Regarding the associated variable Chaos_Collision_Manifold_TriangleConvexMarginMultiplier:
The purpose of this variable is identical to p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier, as they share the same value and are used interchangeably in the code.
It is used directly in the Chaos physics subsystem, specifically in the collision manifold generation process for triangle-convex collisions.
The value is set in the same location as p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier and is used to calculate the ConvexMargin in the ConstructPlanarConvexTriangleOneShotManifold function.
This variable directly interacts with the Convex object’s margin, multiplying it to determine the final margin used in collision calculations.
Developers should be aware that modifying this variable will have a direct impact on the behavior of triangle-convex collisions in the Chaos physics system.
Best practices for using this variable are the same as those for p.Chaos.Collision.Manifold.TriangleConvexMarginMultiplier, as they are effectively the same variable.
#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:52
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// 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(""));
FRealSingle Chaos_Collision_Manifold_CullDistanceMarginMultiplier = 1.0f;
FAutoConsoleVariableRef CVarChaosCollisioConvexManifoldCullDistanceMarginMultiplier(TEXT("p.Chaos.Collision.Manifold.CullDistanceMarginMultiplier"), Chaos_Collision_Manifold_CullDistanceMarginMultiplier, TEXT(""));
FRealSingle Chaos_Collision_Manifold_MinFaceSearchDistance = 1.0f;
FAutoConsoleVariableRef CVarChaosCollisioConvexManifoldMinFaceSearchDistance(TEXT("p.Chaos.Collision.Manifold.MinFaceSearchDistance"), Chaos_Collision_Manifold_MinFaceSearchDistance, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Collision_Manifold_TriangleConvexMarginMultiplier
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:51
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
// 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(""));
FRealSingle Chaos_Collision_Manifold_CullDistanceMarginMultiplier = 1.0f;
FAutoConsoleVariableRef CVarChaosCollisioConvexManifoldCullDistanceMarginMultiplier(TEXT("p.Chaos.Collision.Manifold.CullDistanceMarginMultiplier"), Chaos_Collision_Manifold_CullDistanceMarginMultiplier, TEXT(""));
FRealSingle Chaos_Collision_Manifold_MinFaceSearchDistance = 1.0f;
FAutoConsoleVariableRef CVarChaosCollisioConvexManifoldMinFaceSearchDistance(TEXT("p.Chaos.Collision.Manifold.MinFaceSearchDistance"), Chaos_Collision_Manifold_MinFaceSearchDistance, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:1257
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void ConstructPlanarConvexTriangleOneShotManifold
Source code excerpt:
// Find the deepest penetration. This is used to determine the planes and points to use for the manifold
// MaxMarginDelta is an upper bound on the distance from the contact on the rounded core shape to the actual shape surface.
const FReal MarginMultiplier = Chaos_Collision_Manifold_TriangleConvexMarginMultiplier;
const FReal ConvexMargin = MarginMultiplier * Convex.GetMargin();
FReal MaxMarginDelta = FReal(0);
int32 VertexIndexA = INDEX_NONE, VertexIndexB = INDEX_NONE;
const TGJKCoreShape<ConvexType> GJKConvex(Convex, ConvexMargin);
const TGJKShape<FTriangle> GJKTriangle(Triangle);
const FVec3 InitialGJKDir = -Triangle.GetCentroid();