p.Chaos.Solver.DebugDrawPostIntegrationShapes

p.Chaos.Solver.DebugDrawPostIntegrationShapes

#Overview

name: p.Chaos.Solver.DebugDrawPostIntegrationShapes

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.Solver.DebugDrawPostIntegrationShapes is to enable debug drawing of shapes in the Chaos physics solver after the integration phase but before the constraint solve phase. This setting is part of the debugging and visualization system for the Chaos physics engine in Unreal Engine 5.

This setting variable is primarily used in the Chaos physics subsystem, which is part of the Experimental module in Unreal Engine 5. It’s specifically utilized within the PBDRigidsSolver (Position Based Dynamics Rigid Solver) component of the Chaos physics engine.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

This variable interacts closely with another variable named ChaosSolverDebugDrawPostIntegrationShapes. They share the same value and are used together to control the debug drawing functionality.

Developers must be aware that this is a debugging feature and should be used primarily during development and testing phases. Enabling this feature may have performance implications, especially in complex scenes with many physics objects.

Best practices for using this variable include:

  1. Use it selectively during debugging sessions, not in production builds.
  2. Combine it with other Chaos solver debug drawing options for comprehensive visualization.
  3. Be mindful of potential performance impact when enabled.
  4. Use it in conjunction with other debugging tools to get a complete picture of the physics simulation.

Regarding the associated variable ChaosSolverDebugDrawPostIntegrationShapes:

The purpose of ChaosSolverDebugDrawPostIntegrationShapes is to store the actual integer value that determines whether post-integration shape drawing is enabled (1) or disabled (0).

This variable is used directly in the FPBDRigidsSolver::PreSolveDebugDraw function to conditionally execute the debug drawing code. When set to 1, it triggers the drawing of shapes using the ChaosSolverDebugDebugDrawSettings with colors specific to the post-integrate state.

The value of this variable is set through the console variable system, linked to the p.Chaos.Solver.DebugDrawPostIntegrationShapes command.

This variable interacts with the DebugDrawShapes function and the ChaosSolverDebugDebugDrawSettings object to control the specifics of the debug drawing.

Developers should be aware that this variable directly controls the execution of debug drawing code, so toggling it will immediately affect the visualization output.

Best practices for using this variable include:

  1. Use it in conjunction with other debug drawing options for a comprehensive view.
  2. Toggle it on and off as needed to isolate specific aspects of the physics simulation.
  3. Be aware of its performance impact, especially in complex scenes.
  4. Use it as part of a broader debugging strategy, combining visual feedback with other diagnostic information.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:187

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		int32 ChaosSolverDebugDrawPostIntegrationShapes = 0;
		int32 ChaosSolverDebugDrawPostIntegrationCollisions = 0;
		FAutoConsoleVariableRef CVarChaosSolverDrawPostIntegrationShapes(TEXT("p.Chaos.Solver.DebugDrawPostIntegrationShapes"), ChaosSolverDebugDrawPostIntegrationShapes, TEXT("Draw Shapes prior to constraint solve phase."));
		FAutoConsoleVariableRef CVarChaosSolverDrawPostIntegrationCollisions(TEXT("p.Chaos.Solver.DebugDrawPostIntegrationCollisions"), ChaosSolverDebugDrawPostIntegrationCollisions, TEXT("Draw Collisions prior to constraint solve phase."));


		DebugDraw::FChaosDebugDrawSettings ChaosSolverDebugDebugDrawSettings(
			/* ArrowSize =					*/ 10.0f,
			/* BodyAxisLen =				*/ 30.0f,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:185

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverDrawPreIntegrationCollisions(TEXT("p.Chaos.Solver.DebugDrawPreIntegrationCollisions"), ChaosSolverDebugDrawPreIntegrationCollisions, TEXT("Draw Collisions prior to integrate."));

		int32 ChaosSolverDebugDrawPostIntegrationShapes = 0;
		int32 ChaosSolverDebugDrawPostIntegrationCollisions = 0;
		FAutoConsoleVariableRef CVarChaosSolverDrawPostIntegrationShapes(TEXT("p.Chaos.Solver.DebugDrawPostIntegrationShapes"), ChaosSolverDebugDrawPostIntegrationShapes, TEXT("Draw Shapes prior to constraint solve phase."));
		FAutoConsoleVariableRef CVarChaosSolverDrawPostIntegrationCollisions(TEXT("p.Chaos.Solver.DebugDrawPostIntegrationCollisions"), ChaosSolverDebugDrawPostIntegrationCollisions, TEXT("Draw Collisions prior to constraint solve phase."));


		DebugDraw::FChaosDebugDrawSettings ChaosSolverDebugDebugDrawSettings(
			/* ArrowSize =					*/ 10.0f,
			/* BodyAxisLen =				*/ 30.0f,

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:2506

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PreSolveDebugDraw

Source code excerpt:

		QUICK_SCOPE_CYCLE_COUNTER(SolverDebugDraw);

		if (ChaosSolverDebugDrawPostIntegrationShapes == 1)
		{
			ChaosSolverDebugDebugDrawSettings.ShapesColorsPerState = DebugDraw::GetDefaultShapesColorsPostIntegrate();

			DebugDrawShapes(!!ChaosSolverDrawShapesShowStatic, !!ChaosSolverDrawShapesShowKinematic, !!ChaosSolverDrawShapesShowDynamic);
		}
		if (ChaosSolverDebugDrawPostIntegrationCollisions == 1)