p.Chaos.Collision.UseConvexTriMesh2

p.Chaos.Collision.UseConvexTriMesh2

#Overview

name: p.Chaos.Collision.UseConvexTriMesh2

This variable is created as a Console Variable (cvar).

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:

  1. Testing both true and false states to ensure proper collision behavior in your specific use case.
  2. Monitoring performance impacts, as different collision methods may have varying computational costs.
  3. Considering the implications on gameplay and physics simulation accuracy when changing this setting.

Regarding the associated variable bChaos_Collision_UseConvexTriMesh2:

#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);