p.Chaos.Solver.DebugDrawPreIntegrationCollisions

p.Chaos.Solver.DebugDrawPreIntegrationCollisions

#Overview

name: p.Chaos.Solver.DebugDrawPreIntegrationCollisions

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.DebugDrawPreIntegrationCollisions is to enable debug drawing of collisions prior to the integration step in the Chaos physics solver.

This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics framework. It’s specifically used within the PBDRigidsSolver (Position Based Dynamics Rigid Solver) module.

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 several other debug drawing variables in the Chaos solver, such as ChaosSolverDebugDrawPreIntegrationShapes, ChaosSolverDebugDrawPostIntegrationShapes, and ChaosSolverDebugDrawPostIntegrationCollisions. These variables collectively control various aspects of debug visualization for the physics solver.

Developers should be aware that this is a debug feature and should only be enabled when needed for debugging purposes. Enabling it in a shipping build could potentially impact performance.

Best practices for using this variable include:

  1. Only enable it when actively debugging collision issues in the physics solver.
  2. Use it in conjunction with other debug drawing options to get a comprehensive view of the physics state.
  3. Remember to disable it when not needed to avoid unnecessary performance overhead.

Regarding the associated variable ChaosSolverDebugDrawPreIntegrationCollisions:

The purpose of ChaosSolverDebugDrawPreIntegrationCollisions is the same as p.Chaos.Solver.DebugDrawPreIntegrationCollisions. It’s an internal C++ variable that directly corresponds to the console variable.

This variable is used within the FPBDRigidsSolver::PreIntegrateDebugDraw function to determine whether to draw the collisions. When set to 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.DebugDrawPreIntegrationCollisions is changed.

Developers should treat this variable as read-only within C++ code, as its value is controlled by the console variable system. Any changes to this variable should be made through the p.Chaos.Solver.DebugDrawPreIntegrationCollisions console variable.

Best practices for this variable are similar to those for the console variable, with the addition that C++ code should check this variable’s value to determine whether to perform debug drawing operations related to pre-integration collisions.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		int32 ChaosSolverDebugDrawPreIntegrationCollisions = 0;
		FAutoConsoleVariableRef CVarChaosSolverDrawPreIntegrationShapes(TEXT("p.Chaos.Solver.DebugDrawPreIntegrationShapes"), ChaosSolverDebugDrawPreIntegrationShapes, TEXT("Draw Shapes prior to integrate."));
		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."));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		int32 ChaosSolverDebugDrawPreIntegrationShapes = 0;
		int32 ChaosSolverDebugDrawPreIntegrationCollisions = 0;
		FAutoConsoleVariableRef CVarChaosSolverDrawPreIntegrationShapes(TEXT("p.Chaos.Solver.DebugDrawPreIntegrationShapes"), ChaosSolverDebugDrawPreIntegrationShapes, TEXT("Draw Shapes prior to integrate."));
		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."));

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PreIntegrateDebugDraw

Source code excerpt:

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