p.Chaos.DebugDraw.CCDDuration
p.Chaos.DebugDraw.CCDDuration
#Overview
name: p.Chaos.DebugDraw.CCDDuration
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
How long CCD debug draw should remain on screen in seconds. 0 for 1 frame.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.DebugDraw.CCDDuration is to control the duration of Continuous Collision Detection (CCD) debug drawing in the Chaos physics system of Unreal Engine 5. It determines how long CCD debug information remains visible on the screen.
This setting variable is primarily used by the Chaos physics subsystem, specifically in the debug drawing functionality for CCD. It’s part of the Experimental Chaos module in Unreal Engine 5.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.
The associated variable ChaosDebugDrawCCDDuration directly interacts with p.Chaos.DebugDraw.CCDDuration. They share the same value, with ChaosDebugDrawCCDDuration being the actual float variable used in the code to determine the debug draw duration.
Developers should be aware that:
- Setting this variable to 0 will cause the debug draw to last for only one frame.
- This variable affects the performance of debug visualization. Higher values may impact performance if many debug draws are active.
Best practices when using this variable include:
- Use it primarily for debugging and development purposes, not in production builds.
- Adjust the value based on the specific debugging needs. Longer durations are useful for analyzing slow-motion or complex interactions, while shorter durations help in real-time debugging.
- Remember to disable or set to 0 when not actively debugging to avoid unnecessary performance overhead.
Regarding the associated variable ChaosDebugDrawCCDDuration:
- It’s the actual float variable used in the code to control the CCD debug draw duration.
- It’s used directly in drawing functions to set the lifetime of debug shapes and lines.
- It’s accessed in various parts of the Chaos physics code, particularly in collision detection and CCD-related functions.
- Developers should treat it as read-only in most cases, as its value is intended to be controlled through the console variable system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:110
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
float ChaosDebugDrawCCDDuration = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCCDDuration(TEXT("p.Chaos.DebugDraw.CCDDuration"), ChaosDebugDrawCCDDuration, TEXT("How long CCD debug draw should remain on screen in seconds. 0 for 1 frame."));
float ChaosDebugDrawCollisionDuration = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionDuration(TEXT("p.Chaos.DebugDraw.CollisionDuration"), ChaosDebugDrawCollisionDuration, TEXT("How long Collision debug draw should remain on screen in seconds. 0 for 1 frame."));
bool bChaosDebugDrawCollisionAnchors = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionAnchors(TEXT("p.Chaos.DebugDraw.ShowCollisionAnchors"), bChaosDebugDrawCollisionAnchors, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosDebugDrawCCDDuration
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:109
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
FAutoConsoleVariableRef CVarChaosDebugDrawConvexExplodeDistance(TEXT("p.Chaos.DebugDraw.ConvexExplodeDistance"), ChaosDebugDrawConvexExplodeDistance, TEXT("Explode convex edges by this amount (useful for looking at convex integrity)"));
float ChaosDebugDrawCCDDuration = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCCDDuration(TEXT("p.Chaos.DebugDraw.CCDDuration"), ChaosDebugDrawCCDDuration, TEXT("How long CCD debug draw should remain on screen in seconds. 0 for 1 frame."));
float ChaosDebugDrawCollisionDuration = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionDuration(TEXT("p.Chaos.DebugDraw.CollisionDuration"), ChaosDebugDrawCollisionDuration, TEXT("How long Collision debug draw should remain on screen in seconds. 0 for 1 frame."));
bool bChaosDebugDrawCollisionAnchors = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionAnchors(TEXT("p.Chaos.DebugDraw.ShowCollisionAnchors"), bChaosDebugDrawCollisionAnchors, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:1430
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
function void DrawCCDCollisionImpulseImpl
Source code excerpt:
void DrawCCDCollisionImpulseImpl(const FRigidTransform3& SpaceTransform, const FCCDConstraint& CCDConstraint, const int32 ManifoldPointIndex, const FVec3& Impulse, const FChaosDebugDrawSettings& Settings)
{
const FRealSingle Duration = ChaosDebugDrawCCDDuration;
DrawCollisionImpl(SpaceTransform, CCDConstraint.SweptConstraint, 1.0f, Duration, Settings);
DrawParticleCCDCollisionImpulseImpl(SpaceTransform, CCDConstraint.Particle[0], CCDConstraint, ManifoldPointIndex, Impulse, Duration, Settings);
DrawParticleCCDCollisionImpulseImpl(SpaceTransform, CCDConstraint.Particle[1], CCDConstraint, ManifoldPointIndex, Impulse, Duration, Settings);
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:44
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
namespace DebugDraw
{
extern float ChaosDebugDrawCCDDuration;
}
#endif
namespace CVars
{
Chaos::FRealSingle Chaos_Collision_CullDistanceScaleInverseSize = 0.01f; // 100cm
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:605
Scope (from outer to inner):
file
namespace Chaos
function int32 FSingleShapePairCollisionDetector::GenerateCollisionCCDImpl
Source code excerpt:
if (FConstGenericParticleHandle(Constraint->GetParticle0())->CCDEnabled())
{
DebugDraw::DrawShape(CCDShapeWorldTransform0, Constraint->GetImplicit0(), Shape0, FColor::Black, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
DebugDraw::DrawShape(ShapeWorldTransform0, Constraint->GetImplicit0(), Shape0, FColor::White, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
}
if (FConstGenericParticleHandle(Constraint->GetParticle1())->CCDEnabled())
{
DebugDraw::DrawShape(CCDShapeWorldTransform1, Constraint->GetImplicit1(), Shape1, FColor::Black, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
DebugDraw::DrawShape(ShapeWorldTransform1, Constraint->GetImplicit1(), Shape1, FColor::White, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
}
}
#endif
// @todo(chaos): we always activate swept constraints because the CCD roll-back loops over the active constraints.
// Fix this - we should only activate constraints when we have a Phi within CullDistance
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/ParticlePairMidPhase.cpp:1961
Scope (from outer to inner):
file
namespace Chaos
function bool FGenericParticlePairMidPhase::UpdateCollisionCCD
Source code excerpt:
if (FConstGenericParticleHandle(Constraint->GetParticle0())->CCDEnabled())
{
DebugDraw::DrawShape(CCDShapeWorldTransform0, Constraint->GetImplicit0(), Constraint->GetShape0(), FColor::Black, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
DebugDraw::DrawShape(ShapeWorldTransform0, Constraint->GetImplicit0(), Constraint->GetShape0(), FColor::White, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
}
if (FConstGenericParticleHandle(Constraint->GetParticle1())->CCDEnabled())
{
DebugDraw::DrawShape(CCDShapeWorldTransform1, Constraint->GetImplicit1(), Constraint->GetShape1(), FColor::Black, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
DebugDraw::DrawShape(ShapeWorldTransform1, Constraint->GetImplicit1(), Constraint->GetShape1(), FColor::White, DebugDraw::ChaosDebugDrawCCDDuration, &CVars::ChaosSolverDebugDebugDrawSettings);
}
}
#endif
bool bShouldActivate = bDidSweep && (Constraint->GetCCDTimeOfImpact() < FReal(1));