p.Chaos.DebugDraw.ShowShapeBounds

p.Chaos.DebugDraw.ShowShapeBounds

#Overview

name: p.Chaos.DebugDraw.ShowShapeBounds

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.ShowShapeBounds is to control the debug visualization of shape bounds in the Chaos physics system within Unreal Engine 5. It is specifically used for debugging and development purposes in the physics simulation.

This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics framework. It is referenced in the ChaosDebugDraw.cpp file, indicating its use in the debug drawing functionality of the Chaos system.

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

The associated variable bChaosDebugDebugDrawShapeBounds interacts directly with p.Chaos.DebugDraw.ShowShapeBounds. They share the same value, with bChaosDebugDebugDrawShapeBounds being the actual boolean variable used in the code to determine whether to draw the shape bounds.

Developers should be aware that this variable is specifically for debugging purposes and should not be relied upon for gameplay or production features. It’s intended to help visualize the physics simulation during development and troubleshooting.

Best practices when using this variable include:

  1. Only enable it when necessary for debugging, as it may impact performance.
  2. Use it in conjunction with other Chaos debug drawing options for a comprehensive view of the physics simulation.
  3. Remember to disable it in release builds or when performance is a concern.

Regarding the associated variable bChaosDebugDebugDrawShapeBounds:

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:

	{
		bool bChaosDebugDebugDrawShapeBounds = false;
		FAutoConsoleVariableRef CVarChaosDebugDrawShapeBounds(TEXT("p.Chaos.DebugDraw.ShowShapeBounds"), bChaosDebugDebugDrawShapeBounds, TEXT("Whether to show the bounds of each shape in DrawShapes"));

		bool bChaosDebugDebugDrawCollisionParticles = false;
		FAutoConsoleVariableRef CVarChaosDebugDrawShapeParticles(TEXT("p.Chaos.DebugDraw.ShowCollisionParticles"), bChaosDebugDebugDrawCollisionParticles, TEXT("Whether to show the collision particles if present"));

		bool bChaosDebugDebugDrawInactiveContacts = true;
		FAutoConsoleVariableRef CVarChaosDebugDrawInactiveContacts(TEXT("p.Chaos.DebugDraw.ShowInactiveContacts"), bChaosDebugDebugDrawInactiveContacts, TEXT("Whether to show inactive contacts (ones that contributed no impulses or pushout)"));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw

Source code excerpt:

	namespace DebugDraw
	{
		bool bChaosDebugDebugDrawShapeBounds = false;
		FAutoConsoleVariableRef CVarChaosDebugDrawShapeBounds(TEXT("p.Chaos.DebugDraw.ShowShapeBounds"), bChaosDebugDebugDrawShapeBounds, TEXT("Whether to show the bounds of each shape in DrawShapes"));

		bool bChaosDebugDebugDrawCollisionParticles = false;
		FAutoConsoleVariableRef CVarChaosDebugDrawShapeParticles(TEXT("p.Chaos.DebugDraw.ShowCollisionParticles"), bChaosDebugDebugDrawCollisionParticles, TEXT("Whether to show the collision particles if present"));

		bool bChaosDebugDebugDrawInactiveContacts = true;
		FAutoConsoleVariableRef CVarChaosDebugDrawInactiveContacts(TEXT("p.Chaos.DebugDraw.ShowInactiveContacts"), bChaosDebugDebugDrawInactiveContacts, TEXT("Whether to show inactive contacts (ones that contributed no impulses or pushout)"));

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    DebugDraw
function     void DrawShapesImpl

Source code excerpt:

			}

			if (bChaosDebugDebugDrawShapeBounds)
			{
				const FColor ShapeBoundsColor = FColor::Orange;
				const FAABB3& ShapeBounds = Implicit->BoundingBox();
				const FVec3 ShapeBoundsPos = ShapeTransform.TransformPosition(ShapeBounds.Center());
				FDebugDrawQueue::GetInstance().DrawDebugBox(ShapeBoundsPos, 0.5f * ShapeBounds.Extents(), ShapeTransform.GetRotation(), ShapeBoundsColor, false, Duration, uint8(Settings.DrawPriority), Settings.LineThickness);
			}