p.Chaos.DebugDraw.ShowCollisionAnchors
p.Chaos.DebugDraw.ShowCollisionAnchors
#Overview
name: p.Chaos.DebugDraw.ShowCollisionAnchors
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.DebugDraw.ShowCollisionAnchors is to enable or disable the debug drawing of collision anchors in the Chaos physics system of Unreal Engine 5. This setting is primarily used for debugging and visualizing the physics simulation, specifically the collision detection and response.
-
The Chaos physics subsystem within Unreal Engine 5 relies on this setting variable. It’s part of the experimental Chaos module, which is the new physics engine introduced in Unreal Engine.
-
The value of this variable is set using the FAutoConsoleVariableRef system, which allows it to be changed at runtime through console commands. It’s initialized to false (0.0f) by default.
-
This variable interacts directly with its associated boolean variable bChaosDebugDrawCollisionAnchors. They share the same value and are used interchangeably in the code.
-
Developers must be aware that this is a debug feature and should only be enabled when needed for debugging purposes. Enabling it in a release build or leaving it on during normal gameplay could potentially impact performance.
-
Best practices when using this variable include:
- Only enable it when actively debugging collision issues.
- Use it in conjunction with other Chaos debug draw features for a comprehensive view of the physics simulation.
- Remember to disable it when finished debugging to avoid any potential performance impact.
Regarding the associated variable bChaosDebugDrawCollisionAnchors:
- Its purpose is the same as p.Chaos.DebugDraw.ShowCollisionAnchors - to control the debug drawing of collision anchors.
- It’s used directly in the DrawCollisionImpl function to determine whether to draw the static friction anchors.
- The value is set through the console variable system and can be changed at runtime.
- Developers should treat it the same way as p.Chaos.DebugDraw.ShowCollisionAnchors, using it for debugging purposes only.
- When working with this variable, ensure that the performance impact of debug drawing is considered, especially in non-development builds.
#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:116
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
bool bChaosDebugDrawCollisionAnchors = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionAnchors(TEXT("p.Chaos.DebugDraw.ShowCollisionAnchors"), bChaosDebugDrawCollisionAnchors, TEXT(""));
int32 ChaosConnectionGraphDrawLevelOffset = 0;
FAutoConsoleVariableRef CVarChaosConnectionGraphDrawLevelOffset(TEXT("p.Chaos.DebugDraw.ConnectionGraphLevelOffset"), ChaosConnectionGraphDrawLevelOffset, TEXT("If 0, draws the connection graph between children particles of active particles. If 1, draws the connection grpah between grand-children particles of active particles, etc."));
bool bChaosDebugDrawConnectionGraphShowAreas = false;
FAutoConsoleVariableRef CVarChaosDebugDrawConnectionGraphShowAreas(TEXT("p.Chaos.DebugDraw.ConnectionGraph.ShowAreas"), bChaosDebugDrawConnectionGraphShowAreas, TEXT("When displaying connection graphs show connection areas as disks"));
#Associated Variable and Callsites
This variable is associated with another variable named bChaosDebugDrawCollisionAnchors
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:115
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
Source code excerpt:
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionDuration(TEXT("p.Chaos.DebugDraw.CollisionDuration"), ChaosDebugDrawCollisionDuration, TEXT("How long Collision debug draw should remain on screen in seconds. 0 for 1 frame."));
bool bChaosDebugDrawCollisionAnchors = 0.0f;
FAutoConsoleVariableRef CVarChaosDebugDrawCollisionAnchors(TEXT("p.Chaos.DebugDraw.ShowCollisionAnchors"), bChaosDebugDrawCollisionAnchors, TEXT(""));
int32 ChaosConnectionGraphDrawLevelOffset = 0;
FAutoConsoleVariableRef CVarChaosConnectionGraphDrawLevelOffset(TEXT("p.Chaos.DebugDraw.ConnectionGraphLevelOffset"), ChaosConnectionGraphDrawLevelOffset, TEXT("If 0, draws the connection graph between children particles of active particles. If 1, draws the connection grpah between grand-children particles of active particles, etc."));
bool bChaosDebugDrawConnectionGraphShowAreas = false;
FAutoConsoleVariableRef CVarChaosDebugDrawConnectionGraphShowAreas(TEXT("p.Chaos.DebugDraw.ConnectionGraph.ShowAreas"), bChaosDebugDrawConnectionGraphShowAreas, TEXT("When displaying connection graphs show connection areas as disks"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ChaosDebugDraw.cpp:1369
Scope (from outer to inner):
file
namespace Chaos
namespace DebugDraw
function void DrawCollisionImpl
Source code excerpt:
// Static Friction Anchors (bets viewed with DebugDrawPostIntegrateCollisions)
if (bChaosDebugDrawCollisionAnchors)
{
for (int32 PointIndex = 0; PointIndex < Contact.NumSavedManifoldPoints(); ++PointIndex)
{
const FSavedManifoldPoint& SavedManifoldPoint = Contact.GetSavedManifoldPoint(PointIndex);
const int32 ContactPlaneOwner = 1;
const int32 ContactPointOwner = 1 - ContactPlaneOwner;