p.Chaos.DebugDraw.ShowContactGraph
p.Chaos.DebugDraw.ShowContactGraph
#Overview
name: p.Chaos.DebugDraw.ShowContactGraph
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to show the contactgraph when drawing islands
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.DebugDraw.ShowContactGraph is to enable or disable the visualization of the contact graph when drawing islands in the Chaos physics system of Unreal Engine 5. This setting is primarily used for debugging and visualizing physics interactions.
This setting variable is used within the Chaos physics system, which is an experimental physics engine in Unreal Engine 5. Specifically, it’s used in the debug drawing functionality of Chaos.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console or configuration files. It’s initialized to false by default.
The p.Chaos.DebugDraw.ShowContactGraph variable interacts with several other debug drawing variables:
- p.Chaos.DebugDraw.ShowContactGraphUsed
- p.Chaos.DebugDraw.ShowContactGraphUnused
- p.Chaos.DebugDraw.ShowIslands
These variables work together to provide different levels of debug visualization for the physics system.
Developers should be aware that this is a debug feature and should only be enabled when needed for debugging or visualization purposes. Enabling it in a shipping build could potentially impact performance.
Best practices when using this variable include:
- Use it in conjunction with other debug drawing options for a more comprehensive view of the physics system.
- Disable it in shipping builds to avoid any potential performance impact.
- Use it to visualize and debug complex physics interactions, particularly when working with islands of rigid bodies.
The associated variable bChaosDebugDebugDrawContactGraph is a boolean that directly controls the behavior enabled by p.Chaos.DebugDraw.ShowContactGraph. It’s used in the implementation of the debug drawing functionality. When bChaosDebugDebugDrawContactGraph is true, the code will draw debug lines representing the contact graph between dynamic particles in the physics simulation.
This associated variable is checked in the DrawConstraintGraphImpl function to determine whether to draw the contact graph. It’s used in conjunction with other debug drawing flags to provide a comprehensive debug visualization of the physics system.
Developers should treat bChaosDebugDebugDrawContactGraph as the internal representation of the console variable p.Chaos.DebugDraw.ShowContactGraph. Modifying bChaosDebugDebugDrawContactGraph directly is not recommended; instead, the console variable should be used to control this debug feature.
#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:98
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
bool bChaosDebugDebugDrawContactGraph = false;
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraph(TEXT("p.Chaos.DebugDraw.ShowContactGraph"), bChaosDebugDebugDrawContactGraph, TEXT("Whether to show the contactgraph when drawing islands"));
bool bChaosDebugDebugDrawContactGraphUsed = false;
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraphUsed(TEXT("p.Chaos.DebugDraw.ShowContactGraphUsed"), bChaosDebugDebugDrawContactGraphUsed, TEXT("Whether to show the used edges contactgraph when drawing islands (collisions with impulse)"));
bool bChaosDebugDebugDrawContactGraphUnused = false;
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraphUnused(TEXT("p.Chaos.DebugDraw.ShowContactGraphUnused"), bChaosDebugDebugDrawContactGraphUnused, TEXT("Whether to show the unused edges contactgraph when drawing islands (collisions with no impulse)"));
#Associated Variable and Callsites
This variable is associated with another variable named bChaosDebugDebugDrawContactGraph
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:97
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
FAutoConsoleVariableRef CVarChaosDebugDrawIslands(TEXT("p.Chaos.DebugDraw.ShowIslands"), bChaosDebugDebugDrawIslands, TEXT("Whether to show the iosland boxes when drawing islands (if you want only the contact graph)"));
bool bChaosDebugDebugDrawContactGraph = false;
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraph(TEXT("p.Chaos.DebugDraw.ShowContactGraph"), bChaosDebugDebugDrawContactGraph, TEXT("Whether to show the contactgraph when drawing islands"));
bool bChaosDebugDebugDrawContactGraphUsed = false;
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraphUsed(TEXT("p.Chaos.DebugDraw.ShowContactGraphUsed"), bChaosDebugDebugDrawContactGraphUsed, TEXT("Whether to show the used edges contactgraph when drawing islands (collisions with impulse)"));
bool bChaosDebugDebugDrawContactGraphUnused = false;
FAutoConsoleVariableRef CVarChaosDebugDrawContactGraphUnused(TEXT("p.Chaos.DebugDraw.ShowContactGraphUnused"), bChaosDebugDebugDrawContactGraphUnused, TEXT("Whether to show the unused edges contactgraph when drawing islands (collisions with no impulse)"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:1739
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
function void DrawConstraintGraphImpl
lambda-function
Source code excerpt:
}
if (bChaosDebugDebugDrawContactGraph)
{
if (FConstGenericParticleHandle(Constraint->GetParticle0())->IsDynamic())
{
FDebugDrawQueue::GetInstance().DrawDebugLine(Transform0.GetLocation(), ContactPos, FColor::Red, false, UE_KINDA_SMALL_NUMBER, uint8(Settings.DrawPriority), Settings.LineThickness);
}
if (FConstGenericParticleHandle(Constraint->GetParticle1())->IsDynamic())
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:1783
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
function void DrawConstraintGraphImpl
Source code excerpt:
}
if (bChaosDebugDebugDrawContactGraph || bChaosDebugDebugDrawContactGraphUnused || bChaosDebugDebugDrawContactGraphUsed)
{
for (int32 ContainerIndex = 0; ContainerIndex < Graph.GetNumConstraintContainers(); ++ContainerIndex)
{
Graph.VisitConstConstraints(ContainerIndex,
[&Graph, &SpaceTransform, &Settings, &DrawGraphCollision](const Private::FPBDIslandConstraint* IslandConstraint)
{