p.Chaos.DebugDraw.Mode

p.Chaos.DebugDraw.Mode

#Overview

name: p.Chaos.DebugDraw.Mode

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.Mode is to control where debug draw commands for the Chaos physics system are sent in Unreal Engine 5. It is primarily used for debugging and visualization purposes within the Chaos physics system.

This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics engine. It is referenced in the ChaosSolverEngine module, specifically in the ChaosDebugDrawComponent.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console. It is associated with the bChaosDebugDraw_DrawMode variable, which shares the same value.

The variable interacts with the debug drawing system and determines where the debug draw commands are sent. It has three possible values: 0 - UE Debug Draw 1 - VisLog 2 - Both UE Debug Draw and VisLog

Developers should be aware that this variable affects the visibility and method of debugging Chaos physics. Changing this value will impact where and how debug information is displayed.

Best practices when using this variable include:

  1. Use it primarily for debugging and development purposes.
  2. Be aware of performance implications when enabling debug drawing, especially in production builds.
  3. Consider using different modes (UE Debug Draw vs. VisLog) depending on the specific debugging needs.

Regarding the associated variable bChaosDebugDraw_DrawMode:

In summary, p.Chaos.DebugDraw.Mode and its associated variable bChaosDebugDraw_DrawMode are crucial for controlling and customizing the debug visualization of the Chaos physics system in Unreal Engine 5.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:52

Scope: file

Source code excerpt:


int bChaosDebugDraw_DrawMode = 0;
FAutoConsoleVariableRef CVarArrowSize(TEXT("p.Chaos.DebugDraw.Mode"), bChaosDebugDraw_DrawMode, TEXT("Where to send debug draw commands. 0 = UE Debug Draw; 1 = VisLog; 2 = Both"));


float CommandLifeTime(const Chaos::FLatentDrawCommand& Command, const bool bIsPaused)
{
	// The linebatch time handling is a bit awkward and we need to translate
	// Linebatcher Lifetime < 0: eternal (regardless of bPersistent flag)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:51

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaos_DebugDraw_ShowPIEClient(TEXT("p.Chaos.DebugDraw.ShowPIEClient"), ChaosDebugDraw_ShowPIEClient, TEXT("When running in PIE mode, show the client debug draw"));

int bChaosDebugDraw_DrawMode = 0;
FAutoConsoleVariableRef CVarArrowSize(TEXT("p.Chaos.DebugDraw.Mode"), bChaosDebugDraw_DrawMode, TEXT("Where to send debug draw commands. 0 = UE Debug Draw; 1 = VisLog; 2 = Both"));


float CommandLifeTime(const Chaos::FLatentDrawCommand& Command, const bool bIsPaused)
{
	// The linebatch time handling is a bit awkward and we need to translate
	// Linebatcher Lifetime < 0: eternal (regardless of bPersistent flag)

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:105

Scope (from outer to inner):

file
function     void DebugDrawChaos

Source code excerpt:


	// Draw all the captured elements in the viewport
	const bool bDrawUe = bChaosDebugDraw_DrawMode != 1;
	if (bDrawUe)
	{
		for (const FLatentDrawCommand& Command : DrawCommands)
		{
			const uint8 DepthPriority = ChaosDebugDraw_SeeThrough ? Command.DepthPriority: 0;
			switch (Command.Type)

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/ChaosSolverEngine/Private/Chaos/ChaosDebugDrawComponent.cpp:147

Scope (from outer to inner):

file
function     void DebugDrawChaos

Source code excerpt:


	// Draw all the captured elements in the VisLog
	const bool bDrawVisLog = bChaosDebugDraw_DrawMode != 0;
	if (bDrawVisLog)
	{
		for (const FLatentDrawCommand& Command : DrawCommands)
		{
			const AActor* Actor = (Command.TestBaseActor) ? Command.TestBaseActor : DebugDrawActor;