P.Chaos.DrawHierarchy.ObjectBounds
P.Chaos.DrawHierarchy.ObjectBounds
#Overview
name: P.Chaos.DrawHierarchy.ObjectBounds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable / disable drawing of the physics hierarchy object bounds
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of P.Chaos.DrawHierarchy.ObjectBounds is to enable or disable the drawing of physics hierarchy object bounds in Unreal Engine’s Chaos physics system. This setting is part of the debug visualization tools for the physics engine.
This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s physics engine. It’s specifically utilized in the experimental PhysScene_Chaos module, as evident from the file path.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning it’s enabled by default. Users can change this value at runtime using console commands.
The associated variable CVar_ChaosDrawHierarchyObjectBounds interacts directly with P.Chaos.DrawHierarchy.ObjectBounds. They share the same value and purpose.
Developers must be aware that this is a debugging tool. Enabling it may have performance implications, especially in complex scenes with many physics objects. It should generally be disabled in release builds or final products.
Best practices when using this variable include:
- Use it primarily during development and debugging phases.
- Combine it with other debug drawing options (like CVar_ChaosDrawHierarchyBounds and CVar_ChaosDrawHierarchyCells) for a comprehensive view of the physics hierarchy.
- Be mindful of performance impact when enabled, especially in heavy scenes.
- Consider creating a debug menu or keyboard shortcut in your game to toggle this and other debug visualizations easily during testing.
Regarding the associated variable CVar_ChaosDrawHierarchyObjectBounds:
The purpose of CVar_ChaosDrawHierarchyObjectBounds is identical to P.Chaos.DrawHierarchy.ObjectBounds. It’s the C++ variable that directly controls the console variable.
This variable is used in the Chaos physics subsystem, specifically in the PhysScene_Chaos module of the Engine.
The value is set when the TAutoConsoleVariable is created, with a default value of 1 (enabled). It can be modified at runtime through console commands.
CVar_ChaosDrawHierarchyObjectBounds interacts with other debug drawing variables like CVar_ChaosDrawHierarchyBounds and CVar_ChaosDrawHierarchyCells to provide a comprehensive debug view of the physics system.
Developers should be aware that this is an auto console variable, meaning it can be changed at runtime. Changes will immediately affect the debug visualization.
Best practices include using GetValueOnGameThread() to safely access the current value of the variable, as shown in the provided code snippet. This ensures thread-safe access to the variable’s value.
#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:41
Scope: file
Source code excerpt:
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."));
#endif
#Associated Variable and Callsites
This variable is associated with another variable named CVar_ChaosDrawHierarchyObjectBounds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:41
Scope: file
Source code excerpt:
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."));
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:339
Scope (from outer to inner):
file
class class FPhysicsThreadSyncCaller : public FTickableGameObject
function void DebugDrawSolvers
Source code excerpt:
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();
for(const FWorldContext& Context : WorldContexts)
{
UWorld* TestWorld = Context.World();