P.Chaos.DrawHierarchy.DrawEmptyCells
P.Chaos.DrawHierarchy.DrawEmptyCells
#Overview
name: P.Chaos.DrawHierarchy.DrawEmptyCells
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to draw cells that are empty when cells are enabled.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of P.Chaos.DrawHierarchy.DrawEmptyCells is to control the visualization of empty cells in the Chaos physics hierarchy when debugging or rendering the physics system. This setting variable is part of the debugging and visualization tools for the Chaos physics engine in Unreal Engine 5.
This setting variable is primarily used by the Chaos physics system, which is part of the physics engine module in Unreal Engine 5. Based on the callsites, it’s specifically used in the PhysScene_Chaos.cpp file, which is responsible for managing the physics scene in the Chaos system.
The value of this variable is set as a console variable (CVar) with an initial value of 1 (enabled by default). It can be changed at runtime through the console or programmatically.
This variable interacts with several other debugging-related variables for the Chaos physics system, such as CVar_ChaosDrawHierarchyEnable, CVar_ChaosDrawHierarchyCells, and CVar_ChaosDrawHierarchyBounds. These variables collectively control various aspects of the physics hierarchy visualization.
Developers should be aware that this variable is primarily intended for debugging and visualization purposes. Enabling it may have performance implications, especially in complex scenes with many physics objects. It should typically be disabled in release builds or when not actively debugging physics issues.
Best practices for using this variable include:
- Use it in conjunction with other Chaos physics debugging tools for a comprehensive view of the physics hierarchy.
- Be mindful of performance impacts when enabling this in complex scenes.
- Disable it when not actively debugging physics issues, especially in release builds.
- Use it to identify potential issues with the spatial partitioning of physics objects in the Chaos system.
Regarding the associated variable CVar_ChaosDrawHierarchyDrawEmptyCells:
This is the actual console variable object that controls the P.Chaos.DrawHierarchy.DrawEmptyCells setting. It’s an instance of TAutoConsoleVariable
The purpose of this variable is the same as P.Chaos.DrawHierarchy.DrawEmptyCells - to control the visualization of empty cells in the Chaos physics hierarchy.
This variable is used directly in the DebugDrawSolvers function of the FPhysicsThreadSyncCaller class, which is responsible for rendering debug information for the physics solvers.
Developers should be aware that changes to this console variable will take effect immediately in the running game or editor session. It can be modified through the console or programmatically using Unreal Engine’s console variable system.
Best practices for using this variable include:
- Use it for temporary debugging in development builds.
- Consider exposing it in a debug menu for easier toggling during playtesting.
- Ensure it’s set to 0 (disabled) in release builds to avoid unnecessary performance overhead.
- Use it in combination with other Chaos physics debugging console variables for a more comprehensive debug view.
#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:43
Scope: file
Source code excerpt:
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
int32 GEnableKinematicDeferralStartPhysicsCondition = 1;
FAutoConsoleVariableRef CVar_EnableKinematicDeferralStartPhysicsCondition(TEXT("p.EnableKinematicDeferralStartPhysicsCondition"), GEnableKinematicDeferralStartPhysicsCondition, TEXT("If is 1, allow kinematics to be deferred in start physics (probably only called from replication tick). If 0, no deferral in startphysics."));
#Associated Variable and Callsites
This variable is associated with another variable named CVar_ChaosDrawHierarchyDrawEmptyCells
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:43
Scope: file
Source code excerpt:
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
int32 GEnableKinematicDeferralStartPhysicsCondition = 1;
FAutoConsoleVariableRef CVar_EnableKinematicDeferralStartPhysicsCondition(TEXT("p.EnableKinematicDeferralStartPhysicsCondition"), GEnableKinematicDeferralStartPhysicsCondition, TEXT("If is 1, allow kinematics to be deferred in start physics (probably only called from replication tick). If 0, no deferral in startphysics."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysScene_Chaos.cpp:337
Scope (from outer to inner):
file
class class FPhysicsThreadSyncCaller : public FTickableGameObject
function void DebugDrawSolvers
Source code excerpt:
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();
for(const FWorldContext& Context : WorldContexts)