p.Chaos.CCD.OnlyConsiderDynamicStatic
p.Chaos.CCD.OnlyConsiderDynamicStatic
#Overview
name: p.Chaos.CCD.OnlyConsiderDynamicStatic
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Only enable CCD for dynamic-static pairs.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.CCD.OnlyConsiderDynamicStatic is to control the behavior of Continuous Collision Detection (CCD) in the Chaos physics engine of Unreal Engine 5. Specifically, it determines whether CCD should be applied only to interactions between dynamic and static objects.
This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics simulation module. It’s referenced in the collision resolution component of the Chaos system.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an integer with a default value of 0, which means that by default, CCD is not restricted to only dynamic-static pairs.
The associated variable CCDOnlyConsiderDynamicStatic directly interacts with p.Chaos.CCD.OnlyConsiderDynamicStatic. They share the same value and are used interchangeably in the code.
Developers must be aware that when this variable is set to a value greater than 0, it will limit CCD to only consider collisions between dynamic and static objects. This can have significant implications for the accuracy and performance of collision detection in physics simulations.
Best practices when using this variable include:
- Carefully consider the trade-offs between performance and simulation accuracy when enabling this option.
- Test thoroughly with different scenarios to ensure that limiting CCD to dynamic-static pairs doesn’t introduce unwanted behavior in your game’s physics.
- Use this in conjunction with other CCD settings to fine-tune the physics simulation for your specific needs.
Regarding the associated variable CCDOnlyConsiderDynamicStatic: This is an integer variable that directly corresponds to the console variable p.Chaos.CCD.OnlyConsiderDynamicStatic. It’s used in the actual code logic to determine whether to apply CCD. When this variable is greater than 0, the ShouldUseCCD function will return false for any collision pair where both objects are not static, effectively limiting CCD to dynamic-static pairs only.
Developers should be aware that changing the value of p.Chaos.CCD.OnlyConsiderDynamicStatic will directly affect the behavior of this variable in the code. It’s crucial to understand that this setting can significantly impact both the performance and the accuracy of physics simulations, especially in scenarios involving fast-moving objects or complex interactions between multiple dynamic objects.
#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:60
Scope: file
Source code excerpt:
int32 CCDOnlyConsiderDynamicStatic = 0;
FAutoConsoleVariableRef CVarCCDOnlyConsiderDynamicStatic(TEXT("p.Chaos.CCD.OnlyConsiderDynamicStatic"), CCDOnlyConsiderDynamicStatic, TEXT("Only enable CCD for dynamic-static pairs."));
int32 ConstraintsDetailedStats = 0;
FAutoConsoleVariableRef CVarConstraintsDetailedStats(TEXT("p.Chaos.Constraints.DetailedStats"), ConstraintsDetailedStats, TEXT("When set to 1, will enable more detailed stats."));
bool bChaos_Collision_AllowLevelsetManifolds = true;
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"));
#Associated Variable and Callsites
This variable is associated with another variable named CCDOnlyConsiderDynamicStatic
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:59
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarUseGenericSweptConvexConstraints(TEXT("p.Chaos.CCD.UseGenericSweptConvexConstraints"), CCDUseGenericSweptConvexConstraints, TEXT("Use generic convex convex swept constraint generation for convex shape pairs which don't have specialized implementations."));
int32 CCDOnlyConsiderDynamicStatic = 0;
FAutoConsoleVariableRef CVarCCDOnlyConsiderDynamicStatic(TEXT("p.Chaos.CCD.OnlyConsiderDynamicStatic"), CCDOnlyConsiderDynamicStatic, TEXT("Only enable CCD for dynamic-static pairs."));
int32 ConstraintsDetailedStats = 0;
FAutoConsoleVariableRef CVarConstraintsDetailedStats(TEXT("p.Chaos.Constraints.DetailedStats"), ConstraintsDetailedStats, TEXT("When set to 1, will enable more detailed stats."));
bool bChaos_Collision_AllowLevelsetManifolds = true;
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"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/CollisionResolution.cpp:107
Scope (from outer to inner):
file
namespace Chaos
namespace Collisions
function bool ShouldUseCCD
Source code excerpt:
bool ShouldUseCCD(const FGeometryParticleHandle* Particle0, const FVec3& DeltaX0, const FGeometryParticleHandle* Particle1, const FVec3& DeltaX1, FVec3& Dir, FReal& Length)
{
if (CCDOnlyConsiderDynamicStatic > 0 && Particle1->ObjectState() != EObjectStateType::Static)
{
return false;
}
const TPBDRigidParticleHandle<FReal, 3>* Rigid0 = Particle0->CastToRigidParticle();
const bool bIsCCDEnabled0 = Rigid0 && Rigid0->CCDEnabled();