p.Chaos.DebugDraw.ShowContactGraphUnused

p.Chaos.DebugDraw.ShowContactGraphUnused

#Overview

name: p.Chaos.DebugDraw.ShowContactGraphUnused

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.DebugDraw.ShowContactGraphUnused is to control the debug visualization of unused edges in the contact graph when drawing islands in the Chaos physics system. Specifically, it shows collisions that have no impulse.

This setting variable is part of the Chaos physics system in Unreal Engine 5, which is an experimental physics solver. It is primarily used in the debug drawing functionality of the Chaos module.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as a boolean flag, initialized to false, and can be toggled on or off during runtime or through configuration files.

This variable interacts closely with another variable named bChaosDebugDebugDrawContactGraphUnused. They share the same value and are used together in the debug drawing logic.

Developers should be aware that this variable is specifically for debugging purposes. It should not be relied upon for gameplay logic or shipping builds. It’s designed to help visualize the physics system’s internal state during development and troubleshooting.

Best practices when using this variable include:

  1. Use it in conjunction with other debug drawing options for a comprehensive view of the physics state.
  2. Remember to disable it in shipping builds to avoid performance overhead.
  3. Use it alongside p.Chaos.DebugDraw.ShowContactGraphUsed for a complete picture of the contact graph.

Regarding the associated variable bChaosDebugDebugDrawContactGraphUnused:

This is the actual boolean flag that controls the debug drawing functionality. It’s directly used in the drawing logic to determine whether to render the unused edges of the contact graph.

The variable is used in the DrawConstraintGraphImpl function, which is part of the debug drawing system for the Chaos physics module. It’s checked alongside other debug drawing flags to determine what elements of the constraint graph should be visualized.

Developers should treat this variable as the internal representation of the console variable. While they can access it directly in code if needed, it’s generally better to use the console variable system for toggling this functionality, as it provides a standardized way to control debug features across the engine.

#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:104

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:


		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)"));

		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."));

#Associated Variable and Callsites

This variable is associated with another variable named bChaosDebugDebugDrawContactGraphUnused. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:103

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:

		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)"));

		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."));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:1733

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw
function     void DrawConstraintGraphImpl
lambda-function

Source code excerpt:

				const FRigidTransform3 Transform1 = FConstGenericParticleHandle(Constraint->GetConstrainedParticles()[1])->GetTransformPQCom() * SpaceTransform;

				if ((bChaosDebugDebugDrawContactGraphUsed && bIsUsed) || (bChaosDebugDebugDrawContactGraphUnused && !bIsUsed))
				{
					FColor Color = bIsUsed ? FColor::Green : FColor::Red;
					FDebugDrawQueue::GetInstance().DrawDebugLine(Transform0.GetLocation(), Transform1.GetLocation(), Color, false, UE_KINDA_SMALL_NUMBER, uint8(Settings.DrawPriority), Settings.LineThickness);
				}

				if (bChaosDebugDebugDrawContactGraph)

#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)
						{