p.Chaos.DebugDraw.ColorShapesByIsland

p.Chaos.DebugDraw.ColorShapesByIsland

#Overview

name: p.Chaos.DebugDraw.ColorShapesByIsland

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.ColorShapesByIsland is to control whether the debug drawing system should use particle island information to determine the color of shapes instead of using the particle state. This setting is part of the Chaos physics debug drawing system in Unreal Engine 5.

This setting variable is primarily used in the Chaos physics subsystem, specifically in its debug drawing functionality. It’s part of the Experimental Chaos module, which is a newer physics system in Unreal Engine.

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

This variable interacts with several other debug drawing settings, such as:

These variables provide different ways to color-code the debug visualization of physics shapes.

Developers should be aware that this is a debug feature and should not be relied upon for gameplay or production builds. It’s primarily useful for visualizing and understanding the behavior of the Chaos physics system during development and debugging.

Best practices when using this variable include:

  1. Use it in conjunction with other debug drawing tools to get a comprehensive view of the physics simulation.
  2. Remember to disable it in release builds to avoid performance overhead.
  3. Be aware that it may change the visual appearance of debug drawings, which could affect interpretation of other debug information.

Regarding the associated variable bChaosDebugDebugDrawColorShapesByIsland:

This is the actual boolean variable that stores the state of the setting. It’s used in the DrawShapesImpl function to determine whether to color shapes based on their island ID. When true, it overrides other coloring methods and uses the GetIslandColor function to determine the shape’s color based on its island ID in the constraint graph.

Developers should note that this variable is directly manipulated by the console command system, and its value reflects the current state of the p.Chaos.DebugDraw.ColorShapesByIsland setting. Any code that needs to check this setting should use this boolean variable rather than trying to query the console variable directly for better performance.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:


		bool bChaosDebugDebugDrawColorShapesByIsland = false;
		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesByIsland(TEXT("p.Chaos.DebugDraw.ColorShapesByIsland"), bChaosDebugDebugDrawColorShapesByIsland, TEXT("Whether to use particle island to define the color of the shapes instead of using the particle state "));

		bool bChaosDebugDebugDrawColorShapesByInternalCluster = false;
		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesByInternalCluster(TEXT("p.Chaos.DebugDraw.ColorShapesByInternalCluster"), bChaosDebugDebugDrawColorShapesByInternalCluster, TEXT("Whether to check if the particle is an internal cluster to define its color (black : regular particle: red :internal cluster )"));

		bool bChaosDebugDebugDrawColorShapesBySimQueryType = false;
		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesBySimQueryType(TEXT("p.Chaos.DebugDraw.ColorShapesBySimQueryType"), bChaosDebugDebugDrawColorShapesBySimQueryType, TEXT("Whether to show with different colors shapes that are sim enabled and query enabled (sim : blue, query : orange)"));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesByShapeType(TEXT("p.Chaos.DebugDraw.ColorShapesByShapeType"), bChaosDebugDebugDrawColorShapesByShapeType, TEXT("Whether to use shape type to define the color of the shapes instead of using the particle state "));

		bool bChaosDebugDebugDrawColorShapesByIsland = false;
		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesByIsland(TEXT("p.Chaos.DebugDraw.ColorShapesByIsland"), bChaosDebugDebugDrawColorShapesByIsland, TEXT("Whether to use particle island to define the color of the shapes instead of using the particle state "));

		bool bChaosDebugDebugDrawColorShapesByInternalCluster = false;
		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesByInternalCluster(TEXT("p.Chaos.DebugDraw.ColorShapesByInternalCluster"), bChaosDebugDebugDrawColorShapesByInternalCluster, TEXT("Whether to check if the particle is an internal cluster to define its color (black : regular particle: red :internal cluster )"));

		bool bChaosDebugDebugDrawColorShapesBySimQueryType = false;
		FAutoConsoleVariableRef CVarChaosDebugDebugDrawColorShapesBySimQueryType(TEXT("p.Chaos.DebugDraw.ColorShapesBySimQueryType"), bChaosDebugDebugDrawColorShapesBySimQueryType, TEXT("Whether to show with different colors shapes that are sim enabled and query enabled (sim : blue, query : orange)"));

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw
function     void DrawShapesImpl

Source code excerpt:

					ShapeColor = Settings.ShapesColorsPerShapeType.GetColorFromShapeType(InnerType);
				}
				if (bChaosDebugDebugDrawColorShapesByIsland)
				{
					const int32 IslandId = (Particle->GetConstraintGraphNode() != nullptr) ? Particle->GetConstraintGraphNode()->GetIslandId() : INDEX_NONE;
					ShapeColor = GetIslandColor(IslandId, true);
				}
				if (bChaosDebugDebugDrawColorShapesByInternalCluster)
				{