p.Chaos.DebugDraw.ShowIslands

p.Chaos.DebugDraw.ShowIslands

#Overview

name: p.Chaos.DebugDraw.ShowIslands

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.DebugDraw.ShowIslands is to control the debug visualization of island boxes in the Chaos physics system. It is used for debugging and visualizing the physical simulation of objects grouped into islands.

This setting variable is primarily used in the Chaos physics module of Unreal Engine 5. Specifically, it is utilized in the debug drawing functionality of the Chaos system.

The value of this variable is set through the Unreal Engine console variable system. It is initialized with a default value of true in the ChaosDebugDraw.cpp file.

The variable p.Chaos.DebugDraw.ShowIslands interacts directly with the C++ boolean variable bChaosDebugDebugDrawIslands. They share the same value, with the console variable acting as an external interface to control the C++ variable.

Developers should be aware that this variable is specifically for debug visualization purposes. It should not be relied upon for gameplay logic or in shipping builds. It’s primarily a tool for developers to understand and troubleshoot the physics simulation.

Best practices when using this variable include:

  1. Use it in conjunction with other debug drawing options for a comprehensive view of the physics simulation.
  2. Remember to disable it in shipping builds to avoid performance overhead.
  3. Use it sparingly and only when necessary, as debug drawing can impact performance.

Regarding the associated variable bChaosDebugDebugDrawIslands:

This is a C++ boolean variable that directly controls whether island boxes are drawn in the Chaos physics debug visualization. It is used within the DrawConstraintGraphImpl function to determine if island AABBs (Axis-Aligned Bounding Boxes) should be drawn.

The value of bChaosDebugDebugDrawIslands is set by the console variable p.Chaos.DebugDraw.ShowIslands. This allows runtime control of the debug visualization through the Unreal Engine console.

When using this variable, developers should be aware that it affects the visual debug output only and does not impact the actual physics simulation. It’s a valuable tool for visualizing how objects are grouped into islands in the Chaos physics system.

Best practices for using bChaosDebugDebugDrawIslands include:

  1. Use it in conjunction with the console variable for easy toggling during runtime.
  2. Be mindful of potential performance impact when enabled, especially with complex scenes.
  3. Consider wrapping usage of this variable with preprocessor directives to exclude it from shipping builds.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:


		bool bChaosDebugDebugDrawIslands = true;
		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)"));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosDebugDrawShowOptimizedConvexes(TEXT("p.Chaos.DebugDraw.ShowOptimizedConvexes"), bChaosDebugDebugDrawShowOptimizedConvexes, TEXT(""));

		bool bChaosDebugDebugDrawIslands = true;
		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)"));

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw
function     void DrawConstraintGraphImpl

Source code excerpt:

			};

			if (bChaosDebugDebugDrawIslands)
			{
				for (int32 IslandIndex = 0; IslandIndex < Graph.GetNumIslands(); ++IslandIndex)
				{
					const Private::FPBDIsland* Island = Graph.GetIsland(IslandIndex);
					FAABB3 IslandAABB = FAABB3::EmptyAABB();