P.Chaos.DrawHierarchy.Enable
P.Chaos.DrawHierarchy.Enable
#Overview
name: P.Chaos.DrawHierarchy.Enable
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable / disable drawing of the physics hierarchy
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of P.Chaos.DrawHierarchy.Enable is to control the drawing of the physics hierarchy in Unreal Engine 5’s Chaos physics system. This setting variable is used for debugging and visualization purposes within the physics system.
The Unreal Engine subsystem that relies on this setting variable is the Chaos physics system, which is part of the physics engine module. This can be seen from the file location (PhysScene_Chaos.cpp) and the naming convention used (CVar_ChaosDrawHierarchyEnable).
The value of this variable is set as a console variable (CVar) with an initial value of 0, meaning it’s disabled by default. It can be changed at runtime through the console or programmatically.
This variable interacts with several other related variables, such as CVar_ChaosDrawHierarchyCells, CVar_ChaosDrawHierarchyBounds, and CVar_ChaosDrawHierarchyObjectBounds. These variables control different aspects of the physics hierarchy visualization.
Developers must be aware that enabling this variable may have performance implications, as it’s used for debug drawing. It should be used primarily during development and debugging phases, not in production builds.
Best practices when using this variable include:
- Only enable it when needed for debugging or visualization purposes.
- Be aware of potential performance impact when enabled.
- Use in conjunction with other related variables to get a comprehensive view of the physics hierarchy.
The associated variable CVar_ChaosDrawHierarchyEnable is actually the same variable as P.Chaos.DrawHierarchy.Enable. It’s defined as a TAutoConsoleVariable
This variable is used in the DebugDrawSolvers() function of the FPhysicsThreadSyncCaller class to determine whether to draw the physics hierarchy. The value is retrieved using the GetValueOnGameThread() method, which suggests that it’s designed to be safely accessed from the game thread.
When working with this variable, developers should remember that it’s part of a larger set of debug drawing options for the Chaos physics system, and they may need to enable or adjust multiple variables to get the desired visualization output.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:38
Scope: file
Source code excerpt:
#include "UObject/UObjectIterator.h"
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyEnable(TEXT("P.Chaos.DrawHierarchy.Enable"), 0, TEXT("Enable / disable drawing of the physics hierarchy"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyCells(TEXT("P.Chaos.DrawHierarchy.Cells"), 0, TEXT("Enable / disable drawing of the physics hierarchy cells"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyBounds(TEXT("P.Chaos.DrawHierarchy.Bounds"), 1, TEXT("Enable / disable drawing of the physics hierarchy bounds"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyObjectBounds(TEXT("P.Chaos.DrawHierarchy.ObjectBounds"), 1, TEXT("Enable / disable drawing of the physics hierarchy object bounds"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyCellElementThresh(TEXT("P.Chaos.DrawHierarchy.CellElementThresh"), 128, TEXT("Num elements to consider \"high\" for cell colouring when rendering."));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyDrawEmptyCells(TEXT("P.Chaos.DrawHierarchy.DrawEmptyCells"), 1, TEXT("Whether to draw cells that are empty when cells are enabled."));
TAutoConsoleVariable<int32> CVar_ChaosUpdateKinematicsOnDeferredSkelMeshes(TEXT("P.Chaos.UpdateKinematicsOnDeferredSkelMeshes"), 1, TEXT("Whether to defer update kinematics for skeletal meshes."));
#Associated Variable and Callsites
This variable is associated with another variable named CVar_ChaosDrawHierarchyEnable
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:38
Scope: file
Source code excerpt:
#include "UObject/UObjectIterator.h"
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyEnable(TEXT("P.Chaos.DrawHierarchy.Enable"), 0, TEXT("Enable / disable drawing of the physics hierarchy"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyCells(TEXT("P.Chaos.DrawHierarchy.Cells"), 0, TEXT("Enable / disable drawing of the physics hierarchy cells"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyBounds(TEXT("P.Chaos.DrawHierarchy.Bounds"), 1, TEXT("Enable / disable drawing of the physics hierarchy bounds"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyObjectBounds(TEXT("P.Chaos.DrawHierarchy.ObjectBounds"), 1, TEXT("Enable / disable drawing of the physics hierarchy object bounds"));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyCellElementThresh(TEXT("P.Chaos.DrawHierarchy.CellElementThresh"), 128, TEXT("Num elements to consider \"high\" for cell colouring when rendering."));
TAutoConsoleVariable<int32> CVar_ChaosDrawHierarchyDrawEmptyCells(TEXT("P.Chaos.DrawHierarchy.DrawEmptyCells"), 1, TEXT("Whether to draw cells that are empty when cells are enabled."));
TAutoConsoleVariable<int32> CVar_ChaosUpdateKinematicsOnDeferredSkelMeshes(TEXT("P.Chaos.UpdateKinematicsOnDeferredSkelMeshes"), 1, TEXT("Whether to defer update kinematics for skeletal meshes."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:335
Scope (from outer to inner):
file
class class FPhysicsThreadSyncCaller : public FTickableGameObject
function void DebugDrawSolvers
Source code excerpt:
{
using namespace Chaos;
const bool bDrawHier = CVar_ChaosDrawHierarchyEnable.GetValueOnGameThread() != 0;
const bool bDrawCells = CVar_ChaosDrawHierarchyCells.GetValueOnGameThread() != 0;
const bool bDrawEmptyCells = CVar_ChaosDrawHierarchyDrawEmptyCells.GetValueOnGameThread() != 0;
const bool bDrawBounds = CVar_ChaosDrawHierarchyBounds.GetValueOnGameThread() != 0;
const bool bDrawObjectBounds = CVar_ChaosDrawHierarchyObjectBounds.GetValueOnGameThread() != 0;
UWorld* WorldPtr = nullptr;