p.Chaos.Solver.DebugDrawPostIntegrationCollisions

p.Chaos.Solver.DebugDrawPostIntegrationCollisions

#Overview

name: p.Chaos.Solver.DebugDrawPostIntegrationCollisions

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.DebugDrawPostIntegrationCollisions is to enable debug drawing of collisions in the Chaos physics solver prior to the constraint solve phase. This setting variable is part of the debug visualization system for the Chaos physics engine in Unreal Engine 5.

This setting variable is primarily used in the Chaos physics module, which is part of Unreal Engine’s experimental physics system. Based on the callsites, it’s specifically used within the PBDRigidsSolver (Position Based Dynamics Rigids Solver) component of the Chaos system.

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

The associated variable ChaosSolverDebugDrawPostIntegrationCollisions directly interacts with p.Chaos.Solver.DebugDrawPostIntegrationCollisions. They share the same value and are used interchangeably in the code.

Developers must be aware that this is a debug visualization tool and should only be enabled when needed for debugging purposes. Enabling this visualization may have performance implications, especially in complex scenes with many physics objects.

Best practices when using this variable include:

  1. Only enable it when actively debugging collision issues in the Chaos solver.
  2. Use it in conjunction with other debug visualization tools like p.Chaos.Solver.DebugDrawPostIntegrationShapes for a more comprehensive view of the physics state.
  3. Remember to disable it in production builds to avoid unnecessary performance overhead.

Regarding the associated variable ChaosSolverDebugDrawPostIntegrationCollisions:

The purpose of ChaosSolverDebugDrawPostIntegrationCollisions is identical to p.Chaos.Solver.DebugDrawPostIntegrationCollisions. It’s an internal representation of the console variable within the C++ code.

This variable is used directly in the PreSolveDebugDraw function of the FPBDRigidsSolver class to determine whether to draw the collisions. When its value is 1, it triggers the debug drawing of collisions using the DebugDraw::DrawCollisions function.

The value of this variable is set by the console variable system when p.Chaos.Solver.DebugDrawPostIntegrationCollisions is modified.

Developers should treat this variable as read-only within the C++ code, as its value is controlled by the console variable system. Modifying it directly in code could lead to inconsistent behavior with the console variable system.

Best practices for this variable are the same as for p.Chaos.Solver.DebugDrawPostIntegrationCollisions, as they are essentially two sides of the same coin - one for the console variable system, and one for direct use in C++ code.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		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,
			/* ContactLen =					*/ 30.0f,

#Associated Variable and Callsites

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

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

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,
			/* ContactLen =					*/ 30.0f,

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PreSolveDebugDraw

Source code excerpt:

			DebugDrawShapes(!!ChaosSolverDrawShapesShowStatic, !!ChaosSolverDrawShapesShowKinematic, !!ChaosSolverDrawShapesShowDynamic);
		}
		if (ChaosSolverDebugDrawPostIntegrationCollisions == 1)
		{
			DebugDraw::DrawCollisions(FRigidTransform3(), GetEvolution()->GetCollisionConstraints().GetConstraintAllocator(), 1.f, &ChaosSolverDebugDebugDrawSettings);
		}
#endif
	}