p.Chaos.Solver.UseCCD

p.Chaos.Solver.UseCCD

#Overview

name: p.Chaos.Solver.UseCCD

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.Solver.UseCCD is to control the global usage of Continuous Collision Detection (CCD) in the Chaos physics system of Unreal Engine 5. It serves as a master switch for enabling or disabling CCD across the entire physics simulation.

This setting variable is primarily used by the Chaos physics subsystem, which is part of Unreal Engine’s experimental features. It’s specifically utilized within the PBDRigidsSolver module, which handles rigid body dynamics in the Chaos system.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized as true by default, meaning CCD is enabled out of the box. Developers can modify this value at runtime using console commands or through code.

The associated variable bChaosUseCCD directly interacts with p.Chaos.Solver.UseCCD. They share the same value, with bChaosUseCCD being the actual boolean variable used in the code to control CCD behavior.

Developers must be aware that this is a global setting. Changing it will affect the entire physics simulation, potentially impacting performance and collision behavior across the entire game or application. It’s important to note that this setting overrides any particle-specific CCD settings when disabled.

Best practices for using this variable include:

  1. Only disable it if you’re experiencing performance issues and have determined that CCD is the bottleneck.
  2. Test thoroughly after changing this setting, as it can significantly affect collision behavior, especially for fast-moving objects.
  3. Consider using it in conjunction with p.Chaos.Solver.UseMACD for more refined control over collision detection.

Regarding the associated variable bChaosUseCCD:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:374

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		// Enable/Disable CCD. Set to false to disable the system, regardless of particle settings
		bool bChaosUseCCD = true;
		FAutoConsoleVariableRef  CVarChaosUseCCD(TEXT("p.Chaos.Solver.UseCCD"), bChaosUseCCD, TEXT("Global flag to turn CCD on or off. Default is true (on)"), OnCollisionConfigCVarChanged);

		// Enable/Disable MACD (Motion-Aware Collision Detection). Set to false to disable the system, regardless of particle settings
		bool bChaosUseMACD = true;
		FAutoConsoleVariableRef CVarChaos_Collision_UseMACD(TEXT("p.Chaos.Solver.UseMACD"), bChaosUseMACD, TEXT("Global flag to turn Movement-Aware Collision Detection (MACD) on or off. Default is true (on)"), OnCollisionConfigCVarChanged);

		// Use to force all collisions to use MACD for testing (must also have bChaosUseMACD enabled)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:373

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		// Enable/Disable CCD. Set to false to disable the system, regardless of particle settings
		bool bChaosUseCCD = true;
		FAutoConsoleVariableRef  CVarChaosUseCCD(TEXT("p.Chaos.Solver.UseCCD"), bChaosUseCCD, TEXT("Global flag to turn CCD on or off. Default is true (on)"), OnCollisionConfigCVarChanged);

		// Enable/Disable MACD (Motion-Aware Collision Detection). Set to false to disable the system, regardless of particle settings
		bool bChaosUseMACD = true;
		FAutoConsoleVariableRef CVarChaos_Collision_UseMACD(TEXT("p.Chaos.Solver.UseMACD"), bChaosUseMACD, TEXT("Global flag to turn Movement-Aware Collision Detection (MACD) on or off. Default is true (on)"), OnCollisionConfigCVarChanged);

		// Use to force all collisions to use MACD for testing (must also have bChaosUseMACD enabled)

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1287

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PrepareAdvanceBy

Source code excerpt:

		CollisionDetectorSettings.bDeferNarrowPhase = (ChaosSolverCollisionDeferNarrowPhase != 0);
		CollisionDetectorSettings.bAllowManifolds = (ChaosSolverCollisionUseManifolds != 0);
		CollisionDetectorSettings.bAllowCCD = bChaosUseCCD;
		CollisionDetectorSettings.bAllowMACD = bChaosUseMACD;
		MEvolution->GetCollisionConstraints().SetDetectorSettings(CollisionDetectorSettings);
		
		FPBDJointSolverSettings JointsSettings = MEvolution->GetJointConstraints().GetSettings();
		JointsSettings.MinSolverStiffness = ChaosSolverJointMinSolverStiffness;
		JointsSettings.MaxSolverStiffness = ChaosSolverJointMaxSolverStiffness;