p.Chaos.Solver.DebugDrawCCDThresholds
p.Chaos.Solver.DebugDrawCCDThresholds
#Overview
name: p.Chaos.Solver.DebugDrawCCDThresholds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Draw CCD swept thresholds.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.DebugDrawCCDThresholds is to enable debug drawing of Continuous Collision Detection (CCD) swept thresholds in the Chaos physics solver. This setting variable is primarily used for debugging and visualization purposes within the physics simulation system of Unreal Engine 5.
The Chaos physics solver, which is part of the Experimental Chaos module in Unreal Engine 5, relies on this setting variable. It is used specifically in the PBDRigidsEvolution (Position Based Dynamics for Rigid Bodies) component of the solver.
The value of this variable is set through a console variable (CVar) system. It is defined and initialized in the Chaos namespace, specifically in the CVars sub-namespace, as seen in the PBDRigidsSolver.cpp file.
This variable interacts closely with the associated variable ChaosSolverDrawCCDThresholds. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable is primarily for debugging purposes. Enabling it may have performance implications, as it adds additional drawing calls to visualize the CCD thresholds.
Best practices when using this variable include:
- Only enable it when debugging CCD-related issues in the physics simulation.
- Be mindful of potential performance impact when enabled, especially in complex scenes.
- Use it in conjunction with other debug drawing options for a comprehensive view of the physics state.
Regarding the associated variable ChaosSolverDrawCCDThresholds:
The purpose of ChaosSolverDrawCCDThresholds is the same as p.Chaos.Solver.DebugDrawCCDThresholds. It is used internally within the Chaos physics solver to control the debug drawing of CCD thresholds.
This variable is used in the Chaos module, specifically in the PBDRigidsEvolution component. It’s checked in the Integrate function to determine whether to draw the CCD axis threshold for particles.
The value of this variable is set through the console variable system, initialized in the CVars namespace of the Chaos module.
ChaosSolverDrawCCDThresholds directly interacts with p.Chaos.Solver.DebugDrawCCDThresholds, as they share the same value and purpose.
Developers should be aware that this variable is used in conditional compilation blocks (#if CHAOS_DEBUG_DRAW), meaning its functionality is only available in debug builds or when debug drawing is explicitly enabled.
Best practices for using this variable are the same as those for p.Chaos.Solver.DebugDrawCCDThresholds, as they serve the same purpose and are used interchangeably in the code.
#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:155
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverDrawIslandSleepState(TEXT("p.Chaos.Solver.DebugDrawSleepState"), ChaosSolverDebugDrawIslandSleepState, TEXT("Draw island sleep state."));
FAutoConsoleVariableRef CVarChaosSolverDrawCCD(TEXT("p.Chaos.Solver.DebugDrawCCDInteractions"), ChaosSolverDrawCCDInteractions, TEXT("Draw CCD interactions."));
FAutoConsoleVariableRef CVarChaosSolverDrawCCDThresholds(TEXT("p.Chaos.Solver.DebugDrawCCDThresholds"), ChaosSolverDrawCCDThresholds, TEXT("Draw CCD swept thresholds."));
FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesStatic(TEXT("p.Chaos.Solver.DebugDraw.ShowStatics"), ChaosSolverDrawShapesShowStatic, TEXT("If DebugDrawShapes is enabled, whether to show static objects"));
FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesKinematic(TEXT("p.Chaos.Solver.DebugDraw.ShowKinematics"), ChaosSolverDrawShapesShowKinematic, TEXT("If DebugDrawShapes is enabled, whether to show kinematic objects"));
FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesDynamic(TEXT("p.Chaos.Solver.DebugDraw.ShowDynamics"), ChaosSolverDrawShapesShowDynamic, TEXT("If DebugDrawShapes is enabled, whether to show dynamic objects"));
FAutoConsoleVariableRef CVarChaosSolverDrawJoints(TEXT("p.Chaos.Solver.DebugDrawJoints"), ChaosSolverDrawJoints, TEXT("Draw joints"));
FAutoConsoleVariableRef CVarChaosSolverDrawCharacterGroundConstraints(TEXT("p.Chaos.Solver.DebugDrawCharacterGroundConstraints"), ChaosSolverDrawCharacterGroundConstraints, TEXT("Draw character ground constraints"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructure(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure"), ChaosSolverDebugDrawSpatialAccelerationStructure, TEXT("Draw spatial acceleration structure"));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverDrawCCDThresholds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:860
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::Integrate
lambda-function
Source code excerpt:
#if CHAOS_DEBUG_DRAW
if (CVars::ChaosSolverDrawCCDThresholds)
{
DebugDraw::DrawCCDAxisThreshold(Particle.GetX(), Particle.CCDAxisThreshold(), Particle.GetP() - Particle.GetX(), Particle.GetQ());
}
#endif
if (FCCDHelpers::DeltaExceedsThreshold(Particle.CCDAxisThreshold(), Particle.GetP() - Particle.GetX(), Particle.GetQ()))
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:128
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverDebugDrawIslandSleepState = 0;
int32 ChaosSolverDrawCCDInteractions = 0;
int32 ChaosSolverDrawCCDThresholds = 0;
int32 ChaosSolverDrawShapesShowStatic = 1;
int32 ChaosSolverDrawShapesShowKinematic = 1;
int32 ChaosSolverDrawShapesShowDynamic = 1;
int32 ChaosSolverDrawJoints = 0;
int32 ChaosSolverDrawCharacterGroundConstraints = 0;
int32 ChaosSolverDebugDrawSpatialAccelerationStructure = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:155
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverDrawIslandSleepState(TEXT("p.Chaos.Solver.DebugDrawSleepState"), ChaosSolverDebugDrawIslandSleepState, TEXT("Draw island sleep state."));
FAutoConsoleVariableRef CVarChaosSolverDrawCCD(TEXT("p.Chaos.Solver.DebugDrawCCDInteractions"), ChaosSolverDrawCCDInteractions, TEXT("Draw CCD interactions."));
FAutoConsoleVariableRef CVarChaosSolverDrawCCDThresholds(TEXT("p.Chaos.Solver.DebugDrawCCDThresholds"), ChaosSolverDrawCCDThresholds, TEXT("Draw CCD swept thresholds."));
FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesStatic(TEXT("p.Chaos.Solver.DebugDraw.ShowStatics"), ChaosSolverDrawShapesShowStatic, TEXT("If DebugDrawShapes is enabled, whether to show static objects"));
FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesKinematic(TEXT("p.Chaos.Solver.DebugDraw.ShowKinematics"), ChaosSolverDrawShapesShowKinematic, TEXT("If DebugDrawShapes is enabled, whether to show kinematic objects"));
FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesDynamic(TEXT("p.Chaos.Solver.DebugDraw.ShowDynamics"), ChaosSolverDrawShapesShowDynamic, TEXT("If DebugDrawShapes is enabled, whether to show dynamic objects"));
FAutoConsoleVariableRef CVarChaosSolverDrawJoints(TEXT("p.Chaos.Solver.DebugDrawJoints"), ChaosSolverDrawJoints, TEXT("Draw joints"));
FAutoConsoleVariableRef CVarChaosSolverDrawCharacterGroundConstraints(TEXT("p.Chaos.Solver.DebugDrawCharacterGroundConstraints"), ChaosSolverDrawCharacterGroundConstraints, TEXT("Draw character ground constraints"));
FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructure(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure"), ChaosSolverDebugDrawSpatialAccelerationStructure, TEXT("Draw spatial acceleration structure"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PBDRigidsEvolutionGBF.h:34
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
CHAOS_API extern bool bChaosCollisionCCDUseTightBoundingBox;
CHAOS_API extern int32 ChaosCollisionCCDConstraintMaxProcessCount;
CHAOS_API extern int32 ChaosSolverDrawCCDThresholds;
}
using FPBDRigidsEvolutionCallback = TFunction<void(FReal Dt)>;
using FPBDRigidsEvolutionIslandCallback = TFunction<void(int32 Island)>;