p.Chaos.Collision.Manifold.EnableGjkWarmStart

p.Chaos.Collision.Manifold.EnableGjkWarmStart

#Overview

name: p.Chaos.Collision.Manifold.EnableGjkWarmStart

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Collision.Manifold.EnableGjkWarmStart is to control the warm-start functionality for the GJK (Gilbert-Johnson-Keerthi) algorithm in the Chaos physics engine’s collision detection system. This setting is specifically related to the collision manifold computation.

This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s experimental physics system. It is utilized within the collision detection subsystem, particularly in the manifold generation process for convex-convex collisions.

The value of this variable is set through an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files. Its default value is set to true.

The associated variable bChaos_Manifold_EnableGjkWarmStart directly interacts with p.Chaos.Collision.Manifold.EnableGjkWarmStart. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the performance and potentially the accuracy of collision detection in the Chaos physics engine. Enabling GJK warm-start can improve performance by providing a better initial guess for the GJK algorithm, but it might have subtle effects on collision behavior.

Best practices when using this variable include:

  1. Testing thoroughly with both enabled and disabled states to ensure desired physics behavior.
  2. Considering performance implications, especially in scenes with many complex collisions.
  3. Being cautious when modifying this at runtime, as it could cause sudden changes in physics behavior.

Regarding the associated variable bChaos_Manifold_EnableGjkWarmStart:

#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:70

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:


	bool bChaos_Manifold_EnableGjkWarmStart = true;
	FAutoConsoleVariableRef CVarChaos_Manifold_EnableGjkWarmStart(TEXT("p.Chaos.Collision.Manifold.EnableGjkWarmStart"), bChaos_Manifold_EnableGjkWarmStart, TEXT(""));

	// See GJKContactPointMargin for comments on why these matter
	// LWC_TODO: These needs to be a larger values for float builds (1.e-3f)
	FRealSingle Chaos_Collision_GJKEpsilon = 1.e-6f;
	FRealSingle Chaos_Collision_EPAEpsilon = 1.e-6f;
	FAutoConsoleVariableRef CVarChaos_Collision_GJKEpsilon(TEXT("p.Chaos.Collision.GJKEpsilon"), Chaos_Collision_GJKEpsilon, TEXT(""));

#Associated Variable and Callsites

This variable is associated with another variable named bChaos_Manifold_EnableGjkWarmStart. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:69

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	FAutoConsoleVariableRef CVarChaos_Collision_EnableManifoldInject(TEXT("p.Chaos.Collision.EnableManifoldGJKInject"), bChaos_Collision_EnableManifoldGJKInject, TEXT(""));

	bool bChaos_Manifold_EnableGjkWarmStart = true;
	FAutoConsoleVariableRef CVarChaos_Manifold_EnableGjkWarmStart(TEXT("p.Chaos.Collision.Manifold.EnableGjkWarmStart"), bChaos_Manifold_EnableGjkWarmStart, TEXT(""));

	// See GJKContactPointMargin for comments on why these matter
	// LWC_TODO: These needs to be a larger values for float builds (1.e-3f)
	FRealSingle Chaos_Collision_GJKEpsilon = 1.e-6f;
	FRealSingle Chaos_Collision_EPAEpsilon = 1.e-6f;
	FAutoConsoleVariableRef CVarChaos_Collision_GJKEpsilon(TEXT("p.Chaos.Collision.GJKEpsilon"), Chaos_Collision_GJKEpsilon, TEXT(""));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifolds.cpp:806

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void ConstructConvexConvexOneShotManifold

Source code excerpt:

			const FRigidTransform3 Convex2ToConvex1Transform = Convex2Transform.GetRelativeTransformNoScale(Convex1Transform);

			if (!bChaos_Manifold_EnableGjkWarmStart)
			{
				Constraint.GetGJKWarmStartData().Reset();
			}

			// 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.