P.Chaos.DrawHierarchy.Cells
P.Chaos.DrawHierarchy.Cells
#Overview
name: P.Chaos.DrawHierarchy.Cells
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable / disable drawing of the physics hierarchy cells
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of P.Chaos.DrawHierarchy.Cells is to enable or disable the drawing of physics hierarchy cells in Unreal Engine’s Chaos physics system. This setting variable is part of the debugging and visualization tools for the physics system.
This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s physics engine. It’s specifically referenced in the PhysScene_Chaos.cpp file, which is part of the Engine’s runtime module.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default. Developers can change this value at runtime using console commands.
This variable interacts closely with several other debug drawing variables for the Chaos physics system, such as:
- CVar_ChaosDrawHierarchyEnable
- CVar_ChaosDrawHierarchyBounds
- CVar_ChaosDrawHierarchyObjectBounds
- CVar_ChaosDrawHierarchyCellElementThresh
- CVar_ChaosDrawHierarchyDrawEmptyCells
Developers must be aware that this is a debugging tool and should be used primarily during development and testing phases. Enabling this variable may have performance implications, especially in complex scenes with many physics objects.
Best practices when using this variable include:
- Only enable it when needed for debugging or visualization purposes.
- Be mindful of performance impact in complex scenes.
- Use it in conjunction with other related debug drawing variables for a comprehensive view of the physics hierarchy.
- Remember to disable it in release builds or when not actively debugging.
Regarding the associated variable CVar_ChaosDrawHierarchyCells, it’s the actual console variable object that controls this setting. It’s used in the DebugDrawSolvers function to determine whether to draw the physics hierarchy cells. The usage is straightforward: if the value is non-zero, cell drawing is enabled. Developers can modify this value at runtime to toggle the cell drawing on and off as needed during debugging sessions.
#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:39
Scope: file
Source code excerpt:
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_ChaosDrawHierarchyCells
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:39
Scope: file
Source code excerpt:
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:336
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;
const TIndirectArray<FWorldContext>& WorldContexts = GEngine->GetWorldContexts();