p.Chaos.Collision.EnableManifoldGJKInject

p.Chaos.Collision.EnableManifoldGJKInject

#Overview

name: p.Chaos.Collision.EnableManifoldGJKInject

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.EnableManifoldGJKInject is to control the injection of GJK (Gilbert-Johnson-Keerthi) contact points into existing manifolds in the Chaos physics engine’s collision detection system.

This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s experimental features. It is specifically related to the collision detection and manifold generation subsystem within Chaos.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. It is initialized as a boolean value, defaulting to false.

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

Developers must be aware that this variable affects the behavior of manifold generation in collision detection. When enabled, it allows the system to inject GJK contact points into existing manifolds, potentially improving the accuracy of collision detection in certain scenarios.

Best practices when using this variable include:

  1. Testing thoroughly with both enabled and disabled states to ensure desired collision behavior.
  2. Using it in conjunction with other Chaos collision settings for optimal results.
  3. Considering performance implications, as enabling this feature may increase computational cost.

Regarding the associated variable bChaos_Collision_EnableManifoldGJKInject:

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	bool bChaos_Collision_EnableManifoldGJKInject = false;
	FAutoConsoleVariableRef CVarChaos_Collision_EnableManifoldReplace(TEXT("p.Chaos.Collision.EnableManifoldGJKReplace"), bChaos_Collision_EnableManifoldGJKReplace, TEXT(""));
	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)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionConstraint.cpp:24

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	}

	extern bool bChaos_Collision_EnableManifoldGJKInject;
	extern bool bChaos_Collision_EnableManifoldGJKReplace;

	FRealSingle Chaos_Manifold_MatchPositionTolerance = 0.3f;		// Fraction of object size position tolerance
	FRealSingle Chaos_Manifold_MatchNormalTolerance = 0.02f;		// Dot product tolerance
	FAutoConsoleVariableRef CVarChaos_Manifold_MatchPositionTolerance(TEXT("p.Chaos.Collision.Manifold.MatchPositionTolerance"), Chaos_Manifold_MatchPositionTolerance, TEXT("A tolerance as a fraction of object size used to determine if two contact points are the same"));
	FAutoConsoleVariableRef CVarChaos_Manifold_MatchNormalTolerance(TEXT("p.Chaos.Collision.Manifold.MatchNormalTolerance"), Chaos_Manifold_MatchNormalTolerance, TEXT("A tolerance on the normal dot product used to determine if two contact points are the same"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionConstraint.cpp:958

Scope (from outer to inner):

file
namespace    Chaos
function     bool FPBDCollisionConstraint::TryAddManifoldContact

Source code excerpt:


		// If we have a full manifold, see if we can use or reject the GJK point
		if ((ManifoldPoints.Num() == 4) && bChaos_Collision_EnableManifoldGJKInject)
		{
			return TryInsertManifoldContact(NewContactPoint);
		}
		
		return false;
	}

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:


	bool bChaos_Collision_EnableManifoldGJKReplace = false;
	bool bChaos_Collision_EnableManifoldGJKInject = false;
	FAutoConsoleVariableRef CVarChaos_Collision_EnableManifoldReplace(TEXT("p.Chaos.Collision.EnableManifoldGJKReplace"), bChaos_Collision_EnableManifoldGJKReplace, TEXT(""));
	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)