p.Chaos.Solver.DebugDrawCharacterGroundConstraints

p.Chaos.Solver.DebugDrawCharacterGroundConstraints

#Overview

name: p.Chaos.Solver.DebugDrawCharacterGroundConstraints

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.Solver.DebugDrawCharacterGroundConstraints is to enable or disable the debug drawing of character ground constraints in the Chaos physics solver. This setting is part of the debug visualization system for the Chaos physics engine in Unreal Engine 5.

This setting variable is primarily used by the Chaos physics module, which is an experimental physics solver in Unreal Engine 5. It’s specifically related to the debug drawing functionality 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 declared as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.

The associated variable ChaosSolverDrawCharacterGroundConstraints interacts directly with p.Chaos.Solver.DebugDrawCharacterGroundConstraints. They share the same value and purpose.

Developers should be aware that:

  1. This is a debug feature and should not be enabled in shipping builds.
  2. Enabling this feature may impact performance, especially in complex scenes with many character ground constraints.
  3. The debug drawing is only visible when the appropriate debug visualization tools are active in the engine.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Combine it with other debug drawing options for a comprehensive view of the physics state.
  3. Be prepared to disable it when not needed to avoid performance overhead.

Regarding the associated variable ChaosSolverDrawCharacterGroundConstraints: It serves the same purpose as p.Chaos.Solver.DebugDrawCharacterGroundConstraints. It’s an integer variable initialized to 0 (disabled by default) and is used directly in the PostTickDebugDraw function of the FPBDRigidsSolver class to conditionally draw the character ground constraints.

When using this variable, developers should follow the same best practices and be aware of the same considerations as with p.Chaos.Solver.DebugDrawCharacterGroundConstraints. The two variables are effectively interchangeable in terms of their function and usage within the Chaos physics debug system.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesDynamic(TEXT("p.Chaos.Solver.DebugDraw.ShowDynamics"), ChaosSolverDrawShapesShowDynamic, TEXT("If DebugDrawShapes is enabled, whether to show dynamic objects"));
		FAutoConsoleVariableRef CVarChaosSolverDrawJoints(TEXT("p.Chaos.Solver.DebugDrawJoints"), ChaosSolverDrawJoints, TEXT("Draw joints"));
		FAutoConsoleVariableRef CVarChaosSolverDrawCharacterGroundConstraints(TEXT("p.Chaos.Solver.DebugDrawCharacterGroundConstraints"), ChaosSolverDrawCharacterGroundConstraints, TEXT("Draw character ground constraints"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructure(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure"), ChaosSolverDebugDrawSpatialAccelerationStructure, TEXT("Draw spatial acceleration structure"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowLeaves"), ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves, TEXT("Show spatial acceleration structure leaves when its debug draw is enabled"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowNodes(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowNodes"), ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes, TEXT("Show spatial acceleration structure nodes when its debug draw is enabled"));
		FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesCoMConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.CoMConnector"), ChaosSolverDrawJointFeatures.bCoMConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
		FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesActorConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.ActorConnector"), ChaosSolverDrawJointFeatures.bActorConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
		FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesStretch(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.Stretch"), ChaosSolverDrawJointFeatures.bStretch, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		int32 ChaosSolverDrawShapesShowDynamic = 1;
		int32 ChaosSolverDrawJoints = 0;
		int32 ChaosSolverDrawCharacterGroundConstraints = 0;
		int32 ChaosSolverDebugDrawSpatialAccelerationStructure = 0;
		int32 ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves = 0;
		int32 ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes = 0;
		int32 ChaosSolverDebugDrawSuspensionConstraints = 0;
		int32 ChaosSolverDrawClusterConstraints = 0;
		int32 ChaosSolverDebugDrawMeshContacts = 0;

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverDrawShapesShapesDynamic(TEXT("p.Chaos.Solver.DebugDraw.ShowDynamics"), ChaosSolverDrawShapesShowDynamic, TEXT("If DebugDrawShapes is enabled, whether to show dynamic objects"));
		FAutoConsoleVariableRef CVarChaosSolverDrawJoints(TEXT("p.Chaos.Solver.DebugDrawJoints"), ChaosSolverDrawJoints, TEXT("Draw joints"));
		FAutoConsoleVariableRef CVarChaosSolverDrawCharacterGroundConstraints(TEXT("p.Chaos.Solver.DebugDrawCharacterGroundConstraints"), ChaosSolverDrawCharacterGroundConstraints, TEXT("Draw character ground constraints"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructure(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure"), ChaosSolverDebugDrawSpatialAccelerationStructure, TEXT("Draw spatial acceleration structure"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowLeaves"), ChaosSolverDebugDrawSpatialAccelerationStructureShowLeaves, TEXT("Show spatial acceleration structure leaves when its debug draw is enabled"));
		FAutoConsoleVariableRef CVarChaosSolverDebugDrawSpatialAccelerationStructureShowNodes(TEXT("p.Chaos.Solver.DebugDrawSpatialAccelerationStructure.ShowNodes"), ChaosSolverDebugDrawSpatialAccelerationStructureShowNodes, TEXT("Show spatial acceleration structure nodes when its debug draw is enabled"));
		FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesCoMConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.CoMConnector"), ChaosSolverDrawJointFeatures.bCoMConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
		FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesActorConnector(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.ActorConnector"), ChaosSolverDrawJointFeatures.bActorConnector, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));
		FAutoConsoleVariableRef CVarChaosSolverDrawJointFeaturesStretch(TEXT("p.Chaos.Solver.DebugDraw.JointFeatures.Stretch"), ChaosSolverDrawJointFeatures.bStretch, TEXT("Joint features mask (see FDebugDrawJointFeatures)."));

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PostTickDebugDraw

Source code excerpt:

			DebugDraw::DrawJointConstraints(FRigidTransform3(), MEvolution->GetJointConstraints(), 1.0f, ChaosSolverDrawJointFeatures, &ChaosSolverDebugDebugDrawSettings);
		}
		if (ChaosSolverDrawCharacterGroundConstraints == 1)
		{
			DebugDraw::DrawCharacterGroundConstraints(FRigidTransform3(), MEvolution->GetCharacterGroundConstraints(), &ChaosSolverDebugDebugDrawSettings);
		}
		if (ChaosSolverDebugDrawSpatialAccelerationStructure)
		{
			if (const auto SpatialAccelerationStructure = GetEvolution()->GetSpatialAcceleration())