p.Chaos.Collision.UseConvexTriMesh2
p.Chaos.Collision.UseConvexTriMesh2
#Overview
name: p.Chaos.Collision.UseConvexTriMesh2
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.UseConvexTriMesh2 is to control the collision detection method used for convex-triangle mesh collisions in the Chaos physics system of Unreal Engine 5.
This setting variable is primarily used in the Chaos physics subsystem, specifically in the collision detection module. Based on the callsites, it’s part of the Experimental Chaos runtime in Unreal Engine.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files. It’s initialized to true by default.
The associated variable bChaos_Collision_UseConvexTriMesh2 directly interacts with p.Chaos.Collision.UseConvexTriMesh2. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the collision detection algorithm used for convex-triangle mesh collisions. When set to true, it uses a newer method (ConstructConvexTriangleOneShotManifold2), and when false, it falls back to an older method (ConstructPlanarConvexTriangleOneShotManifold).
Best practices when using this variable include:
- Testing both true and false states to ensure proper collision behavior in your specific use case.
- Monitoring performance impacts, as different collision methods may have varying computational costs.
- Considering the implications on gameplay and physics simulation accuracy when changing this setting.
Regarding the associated variable bChaos_Collision_UseConvexTriMesh2:
- Its purpose is identical to p.Chaos.Collision.UseConvexTriMesh2, serving as the internal boolean representation.
- It’s used directly in the collision detection code to determine which algorithm to use.
- The value is set through the console variable system and can be modified at runtime.
- Developers should treat it as read-only within their code, modifying it only through the console variable system to ensure consistency.
- Best practices include using this variable for conditional logic in collision-related code and ensuring it’s properly synchronized with the console variable if manual modifications are necessary.
#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:130
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
bool bChaos_Collision_UseConvexTriMesh2 = true;
FAutoConsoleVariableRef CVarChaos_Collision_UseConvexTriMesh2(TEXT("p.Chaos.Collision.UseConvexTriMesh2"), bChaos_Collision_UseConvexTriMesh2, TEXT(""));
namespace Collisions
{
// Forward delarations we need from CollisionRestitution.cpp
FContactPoint BoxBoxContactPoint(const FImplicitBox3& Box1, const FImplicitBox3& Box2, const FRigidTransform3& Box1TM, const FRigidTransform3& Box2TM);
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_Collision_UseConvexTriMesh2
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:129
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarChaos_Collision_UseCapsuleTriMesh2(TEXT("p.Chaos.Collision.UseCapsuleTriMesh2"), bChaos_Collision_UseCapsuleTriMesh2, TEXT(""));
bool bChaos_Collision_UseConvexTriMesh2 = true;
FAutoConsoleVariableRef CVarChaos_Collision_UseConvexTriMesh2(TEXT("p.Chaos.Collision.UseConvexTriMesh2"), bChaos_Collision_UseConvexTriMesh2, TEXT(""));
namespace Collisions
{
// Forward delarations we need from CollisionRestitution.cpp
FContactPoint BoxBoxContactPoint(const FImplicitBox3& Box1, const FImplicitBox3& Box2, const FRigidTransform3& Box1TM, const FRigidTransform3& Box2TM);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifoldsMeshShapes.cpp:39
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
extern bool bChaos_Collision_UseCapsuleTriMesh2;
extern bool bChaos_Collision_UseConvexTriMesh2;
namespace CVars
{
#if CHAOS_DEBUG_DRAW
extern DebugDraw::FChaosDebugDrawSettings ChaosSolverDebugDebugDrawSettings;
extern int32 ChaosSolverDebugDrawMeshContacts;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifoldsMeshShapes.cpp:96
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function void GenerateConvexTriangleOneShotManifold
Source code excerpt:
void GenerateConvexTriangleOneShotManifold(const ConvexType& Convex, const FTriangle& Triangle, const FReal CullDistance, FContactPointManifold& OutContactPoints)
{
if (bChaos_Collision_UseConvexTriMesh2)
{
ConstructConvexTriangleOneShotManifold2(Convex, Triangle, CullDistance, OutContactPoints);
}
else
{
ConstructPlanarConvexTriangleOneShotManifold(Convex, Triangle, CullDistance, OutContactPoints);