p.Chaos.Collision.Manifold.CapsuleRadialContactFraction

p.Chaos.Collision.Manifold.CapsuleRadialContactFraction

#Overview

name: p.Chaos.Collision.Manifold.CapsuleRadialContactFraction

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.Manifold.CapsuleRadialContactFraction is to control the positioning of additional manifold points when two capsules are in an X configuration during collision detection in Unreal Engine’s Chaos physics system.

This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics framework. It’s specifically related to collision detection and manifold generation for capsule-capsule interactions.

The value of this variable is set in the C++ code with an initial value of 0.25f. It’s then exposed as a console variable, allowing runtime modification through the console or configuration files.

The associated variable Chaos_Collision_Manifold_CapsuleRadialContactFraction directly interacts with p.Chaos.Collision.Manifold.CapsuleRadialContactFraction. They share the same value, with the console variable (p.Chaos.Collision.Manifold.CapsuleRadialContactFraction) controlling the C++ variable (Chaos_Collision_Manifold_CapsuleRadialContactFraction).

Developers should be aware that this variable affects the precision and behavior of capsule-capsule collision detection. Modifying this value will change how additional contact points are generated when capsules intersect in an X configuration, potentially affecting the stability and accuracy of physics simulations involving capsules.

Best practices when using this variable include:

  1. Testing thoroughly after any modifications to ensure desired physics behavior.
  2. Considering performance implications, as generating more contact points could increase computational cost.
  3. Balancing between accuracy (higher values) and performance (lower values) based on the specific needs of the game or simulation.

Regarding the associated variable Chaos_Collision_Manifold_CapsuleRadialContactFraction:

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	// When two capsule lie on top of each other in an X, the extra manifold points are this fraction of the radius from the primary contact point
	FRealSingle Chaos_Collision_Manifold_CapsuleRadialContactFraction = 0.25f;
	FAutoConsoleVariableRef CVarChaos_Manifold_CapsuleRadialContactFraction(TEXT("p.Chaos.Collision.Manifold.CapsuleRadialContactFraction"), Chaos_Collision_Manifold_CapsuleRadialContactFraction, TEXT(""));

	// When a capsule-convex contact has points closer together than this fraction of radius, ignore one of the contacts
	FRealSingle Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction = 0.1f;
	FAutoConsoleVariableRef CVarChaos_Manifold_CapsuleMinContactDistanceFraction(TEXT("p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction"), Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction, TEXT(""));

	FRealSingle Chaos_Collision_Manifold_PlaneContactNormalEpsilon = 0.001f;

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:


	// When two capsule lie on top of each other in an X, the extra manifold points are this fraction of the radius from the primary contact point
	FRealSingle Chaos_Collision_Manifold_CapsuleRadialContactFraction = 0.25f;
	FAutoConsoleVariableRef CVarChaos_Manifold_CapsuleRadialContactFraction(TEXT("p.Chaos.Collision.Manifold.CapsuleRadialContactFraction"), Chaos_Collision_Manifold_CapsuleRadialContactFraction, TEXT(""));

	// When a capsule-convex contact has points closer together than this fraction of radius, ignore one of the contacts
	FRealSingle Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction = 0.1f;
	FAutoConsoleVariableRef CVarChaos_Manifold_CapsuleMinContactDistanceFraction(TEXT("p.Chaos.Collision.Manifold.CapsuleMinContactDistanceFraction"), Chaos_Collision_Manifold_CapsuleMinContactDistanceFraction, TEXT(""));

	FRealSingle Chaos_Collision_Manifold_PlaneContactNormalEpsilon = 0.001f;

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

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	extern FRealSingle Chaos_Collision_Manifold_CapsuleAxisAlignedThreshold;
	extern FRealSingle Chaos_Collision_Manifold_CapsuleDeepPenetrationFraction;
	extern FRealSingle Chaos_Collision_Manifold_CapsuleRadialContactFraction;

	namespace Collisions
	{

		void ConstructSphereSphereOneShotManifold(
			const TSphere<FReal, 3>& SphereA,

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionOneShotManifoldsMiscShapes.cpp:409

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void ConstructCapsuleCapsuleOneShotManifold

Source code excerpt:


			// If the capsules are in an X configuration, this controls the distance of the manifold points from the closest point
			const FReal RadialContactFraction = Chaos_Collision_Manifold_CapsuleRadialContactFraction;

			// Calculate the line segment times for the nearest point calculate above
			// NOTE: TA and TB will be in [-1, 1]
			const FReal TA = FVec3::DotProduct(AClosest - ACenter, AAxis) / AHalfLen;
			const FReal TB = FVec3::DotProduct(BClosest - BCenter, BAxis) / BHalfLen;