p.Chaos.CCD.NoCullAllShapePairs

p.Chaos.CCD.NoCullAllShapePairs

#Overview

name: p.Chaos.CCD.NoCullAllShapePairs

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

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.CCD.NoCullAllShapePairs is to control the culling behavior in Continuous Collision Detection (CCD) for all shape pairs in the Chaos physics engine of Unreal Engine 5. This setting variable is used in the collision resolution system, specifically for swept collision detection.

This setting variable is primarily used in the Chaos physics engine, which is part of the Experimental module in Unreal Engine 5. It is referenced in the CollisionResolution.cpp file, indicating its importance in the collision detection and resolution process.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console. By default, it is set to true.

The associated variable CCDNoCullAllShapePairs interacts directly with p.Chaos.CCD.NoCullAllShapePairs, as they share the same value. This variable is used in various collision detection functions for different shape pairs, such as sphere-heightfield, sphere-triangle mesh, capsule-heightfield, capsule-triangle mesh, convex-heightfield, and convex-triangle mesh.

Developers must be aware that this variable affects the culling behavior for all shape pairs in CCD, not just convex-convex pairs. When set to true, it disables early culling based on phi (penetration depth) for sweeps, which may impact performance but potentially increase accuracy.

Best practices when using this variable include:

  1. Consider the trade-off between performance and accuracy. Disabling culling may increase computational cost but could provide more accurate collision detection.
  2. Test the impact of enabling/disabling this variable in your specific use case to determine the optimal setting.
  3. Be cautious when changing this value at runtime, as it may affect gameplay or simulation behavior.

Regarding the associated variable CCDNoCullAllShapePairs: The purpose of CCDNoCullAllShapePairs is to directly implement the behavior controlled by p.Chaos.CCD.NoCullAllShapePairs. It is used in the UpdateContactPointNoCull function calls throughout the collision resolution code.

This variable is used in the same Chaos physics engine subsystem and is set in the same location as p.Chaos.CCD.NoCullAllShapePairs.

Developers should treat CCDNoCullAllShapePairs as the internal representation of the console variable p.Chaos.CCD.NoCullAllShapePairs. When working with the code directly, use CCDNoCullAllShapePairs, but when adjusting settings through the console or configuration files, use p.Chaos.CCD.NoCullAllShapePairs.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

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

Scope: file

Source code excerpt:


bool CCDNoCullAllShapePairs = true;
FAutoConsoleVariableRef CVarCCDNoCullAllShapePairs(TEXT("p.Chaos.CCD.NoCullAllShapePairs"), CCDNoCullAllShapePairs, TEXT("Whether to cull contacts early based on phi for sweeps for all shape pairs (not just convex convex)."));

bool Chaos_Collision_NarrowPhase_SphereBoundsCheck = true;
bool Chaos_Collision_NarrowPhase_AABBBoundsCheck = true;
FAutoConsoleVariableRef CVarChaosCollisionSphereBoundsCheck(TEXT("p.Chaos.Collision.SphereBoundsCheck"), Chaos_Collision_NarrowPhase_SphereBoundsCheck, TEXT(""));
FAutoConsoleVariableRef CVarChaosCollisionAABBBoundsCheck(TEXT("p.Chaos.Collision.AABBBoundsCheck"), Chaos_Collision_NarrowPhase_AABBBoundsCheck, TEXT(""));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:68

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosCollisionAllowLevelsetManifolds(TEXT("p.Chaos.Collision.AllowLevelsetManifolds"), bChaos_Collision_AllowLevelsetManifolds, TEXT("Use incremental manifolds for levelset-levelset collision. This does not work well atm - too much rotation in the small pieces"));

bool CCDNoCullAllShapePairs = true;
FAutoConsoleVariableRef CVarCCDNoCullAllShapePairs(TEXT("p.Chaos.CCD.NoCullAllShapePairs"), CCDNoCullAllShapePairs, TEXT("Whether to cull contacts early based on phi for sweeps for all shape pairs (not just convex convex)."));

bool Chaos_Collision_NarrowPhase_SphereBoundsCheck = true;
bool Chaos_Collision_NarrowPhase_AABBBoundsCheck = true;
FAutoConsoleVariableRef CVarChaosCollisionSphereBoundsCheck(TEXT("p.Chaos.Collision.SphereBoundsCheck"), Chaos_Collision_NarrowPhase_SphereBoundsCheck, TEXT(""));
FAutoConsoleVariableRef CVarChaosCollisionAABBBoundsCheck(TEXT("p.Chaos.Collision.AABBBoundsCheck"), Chaos_Collision_NarrowPhase_AABBBoundsCheck, TEXT(""));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:530

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void UpdateSphereHeightFieldConstraintSwept

Source code excerpt:

		{
			FReal TOI = FPBDCollisionConstraint::MaxTOI;
			UpdateContactPointNoCull(Constraint, GJKImplicitSweptContactPoint(A, ATransform, B, BTransform, Dir, Length, Constraint.GetCCDEnablePenetration(), Constraint.GetCCDTargetPenetration(), TOI), Dt, CCDNoCullAllShapePairs);
			Constraint.SetCCDTimeOfImpact(TOI);
		}

		//
		//  Sphere-Plane
		//

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:622

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void UpdateSphereTriangleMeshConstraintSwept

Source code excerpt:

		{
			FReal TOI = FPBDCollisionConstraint::MaxTOI;
			UpdateContactPointNoCull(Constraint, SphereTriangleMeshSweptContactPoint(Sphere0, WorldTransform0, TriangleMesh1, WorldTransform1, Dir, Length, Constraint.GetCCDEnablePenetration(), Constraint.GetCCDTargetPenetration(), TOI), Dt, CCDNoCullAllShapePairs);
			Constraint.SetCCDTimeOfImpact(TOI);
		}

		//
		// Capsule-Capsule
		//

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:752

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void UpdateCapsuleHeightFieldConstraintSwept

Source code excerpt:

			CONDITIONAL_SCOPE_CYCLE_COUNTER(STAT_Collisions_UpdateCapsuleHeightFieldConstraintSwept, ConstraintsDetailedStats);
			FReal TOI = FPBDCollisionConstraint::MaxTOI;
			UpdateContactPointNoCull(Constraint, GJKImplicitSweptContactPoint(A, ATransform, B, BTransform, Dir, Length, Constraint.GetCCDEnablePenetration(), Constraint.GetCCDTargetPenetration(), TOI), Dt, CCDNoCullAllShapePairs);
			Constraint.SetCCDTimeOfImpact(TOI);
		}

		//
		// Capsule-TriangleMesh
		//

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:780

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void UpdateCapsuleTriangleMeshConstraintSwept

Source code excerpt:

			CONDITIONAL_SCOPE_CYCLE_COUNTER(STAT_Collisions_UpdateCapsuleTriangleMeshConstraint, ConstraintsDetailedStats);
			FReal TOI = FPBDCollisionConstraint::MaxTOI;
			UpdateContactPointNoCull(Constraint, CapsuleTriangleMeshSweptContactPoint(Capsule0, WorldTransform0, TriangleMesh1, WorldTransform1, Dir, Length, Constraint.GetCCDEnablePenetration(), Constraint.GetCCDTargetPenetration(), TOI), Dt, CCDNoCullAllShapePairs);
			Constraint.SetCCDTimeOfImpact(TOI);
		}

		//
		// Generic Convex - Convex (actual concrete type could be anything)
		//

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:827

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void UpdateConvexHeightFieldConstraintSwept

Source code excerpt:

			CONDITIONAL_SCOPE_CYCLE_COUNTER(STAT_Collisions_UpdateConvexHeightFieldConstraintSwept, ConstraintsDetailedStats);
			FReal TOI = FPBDCollisionConstraint::MaxTOI;
			UpdateContactPointNoCull(Constraint, GJKImplicitSweptContactPoint(A, ATransform, B, BTransform, Dir, Length, Constraint.GetCCDEnablePenetration(), Constraint.GetCCDTargetPenetration(), TOI), Dt, CCDNoCullAllShapePairs);
			Constraint.SetCCDTimeOfImpact(TOI);
		}

		//
		// Convex-TriangleMesh
		//

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:854

Scope (from outer to inner):

file
namespace    Chaos
namespace    Collisions
function     void UpdateConvexTriangleMeshConstraintSwept

Source code excerpt:

			CONDITIONAL_SCOPE_CYCLE_COUNTER(STAT_Collisions_UpdateConvexTriangleMeshConstraintSwept, ConstraintsDetailedStats);
			FReal TOI = FPBDCollisionConstraint::MaxTOI;
			UpdateContactPointNoCull(Constraint, ConvexTriangleMeshSweptContactPoint(Convex0, WorldTransform0, TriangleMesh1, WorldTransform1, Dir, Length, Constraint.GetCCDEnablePenetration(), Constraint.GetCCDTargetPenetration(), TOI), Dt, CCDNoCullAllShapePairs);
			Constraint.SetCCDTimeOfImpact(TOI);
		}

		//
		// Levelset-Levelset
		//