p.Chaos.DebugDraw.ConvexExplodeDistance
p.Chaos.DebugDraw.ConvexExplodeDistance
#Overview
name: p.Chaos.DebugDraw.ConvexExplodeDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Explode convex edges by this amount (useful for looking at convex integrity)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.DebugDraw.ConvexExplodeDistance is to provide a visual debugging tool for examining the integrity of convex shapes in the Chaos physics system of Unreal Engine 5. It allows developers to “explode” or offset the edges of convex shapes by a specified distance, making it easier to inspect their structure and integrity.
This setting variable is primarily used in the Chaos physics subsystem, specifically in the debug drawing functionality. It’s part of the Experimental Chaos module, which is Unreal Engine’s next-generation physics system.
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 ChaosDebugDrawConvexExplodeDistance directly interacts with p.Chaos.DebugDraw.ConvexExplodeDistance. They share the same value, with ChaosDebugDrawConvexExplodeDistance being the actual float variable used in the code, while p.Chaos.DebugDraw.ConvexExplodeDistance is the console variable name used to set its value.
Developers should be aware that this variable is primarily for debugging purposes. It affects the visual representation of convex shapes in debug draws but does not impact the actual physics simulation. The effect is purely visual and meant for development and troubleshooting.
Best practices when using this variable include:
- Use it in conjunction with other debug drawing tools to get a comprehensive view of the physics objects.
- Adjust the value incrementally to find the best visualization for your specific debugging needs.
- Remember to disable or set it to 0 in production builds to avoid unnecessary performance overhead.
Regarding the associated variable ChaosDebugDrawConvexExplodeDistance:
- Its purpose is to store the actual float value used in the debug drawing calculations.
- It’s used directly in the DrawShapesConvexImpl function to offset the vertices of convex shapes during debug drawing.
- The value is set through the console variable system, allowing for easy adjustment during runtime.
- Developers should treat this variable as read-only in their code, modifying it only through the console variable system to maintain consistency.
#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:107
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
float ChaosDebugDrawConvexExplodeDistance = 0.0f;
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."));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosDebugDrawConvexExplodeDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:106
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraphUnused(TEXT("p.Chaos.DebugDraw.ShowContactGraphUnused"), bChaosDebugDebugDrawContactGraphUnused, TEXT("Whether to show the unused edges contactgraph when drawing islands (collisions with no impulse)"));
float ChaosDebugDrawConvexExplodeDistance = 0.0f;
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."));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:474
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
function void DrawShapesConvexImpl
Source code excerpt:
const FVec3 N0 = ShapeTransform.TransformVectorNoScale(Shape->GetPlane(PlaneIndex).Normal());
const FVec3 ExplodeDelta = ChaosDebugDrawConvexExplodeDistance * N0;
// Outer shape
FDebugDrawQueue::GetInstance().DrawDebugLine(OuterP0 + ExplodeDelta, OuterP1 + ExplodeDelta, Color, false, Duration, uint8(Settings.DrawPriority), Settings.ShapeThicknesScale * Settings.LineThickness);
// Core shape and lines connecting core to outer
if (Margin > 0.0f)