p.GeometryCollection.AlwaysGenerateConnectionGraph
p.GeometryCollection.AlwaysGenerateConnectionGraph
#Overview
name: p.GeometryCollection.AlwaysGenerateConnectionGraph
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When enabled, always generate the cluster\'s connection graph instead of using the rest collection stored one - Note: this should only be used for troubleshooting.[def: false]
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.GeometryCollection.AlwaysGenerateConnectionGraph is to control the generation of connection graphs for geometry collections in Unreal Engine 5’s physics system, specifically for the Chaos physics engine.
This setting variable is primarily used in the Experimental Chaos module, which is part of Unreal Engine 5’s physics system. It is referenced in the GeometryCollectionPhysicsProxy.cpp file, indicating its relevance to the Geometry Collection feature of the physics system.
The value of this variable is set through a console variable (CVar) system. It is initialized as a boolean with a default value of false. Developers can change this value at runtime using console commands or through project settings.
The associated variable bGeometryCollectionAlwaysGenerateConnectionGraph directly interacts with this setting. They share the same value, and the console variable acts as an interface to modify this boolean flag.
Developers must be aware that this variable is intended for troubleshooting purposes only. Enabling it will force the system to always generate the cluster’s connection graph instead of using the stored one from the rest collection.
Best practices when using this variable include:
- Keeping it disabled (false) for normal operation to maintain performance.
- Only enabling it when debugging issues related to geometry collection connection graphs.
- Being cautious about enabling it in production builds, as it may impact performance.
Regarding the associated variable bGeometryCollectionAlwaysGenerateConnectionGraph:
- Its purpose is to act as the actual boolean flag that controls the behavior within the code.
- It is used in the InitializeBodiesPT function of the FGeometryCollectionPhysicsProxy class to determine whether to generate a new connection graph.
- The value is set by the console variable system and can be modified at runtime.
- Developers should treat this variable as read-only within their code and use the console variable to modify its value when needed.
- When this flag is true, it forces the generation of a new connection graph, which may be computationally expensive and should be used judiciously.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:104
Scope: file
Source code excerpt:
bool bGeometryCollectionAlwaysGenerateConnectionGraph = false;
FAutoConsoleVariableRef CVarGeometryCollectionAlwaysGenerateConnectionGraph(
TEXT("p.GeometryCollection.AlwaysGenerateConnectionGraph"),
bGeometryCollectionAlwaysGenerateConnectionGraph,
TEXT("When enabled, always generate the cluster's connection graph instead of using the rest collection stored one - Note: this should only be used for troubleshooting.[def: false]"));
int32 GeometryCollectionAreaBasedDamageThresholdMode = 0;
FAutoConsoleVariableRef CVarGeometryCollectionAreaBasedDamageThresholdMode(
TEXT("p.GeometryCollection.AreaBasedDamageThresholdMode"),
#Associated Variable and Callsites
This variable is associated with another variable named bGeometryCollectionAlwaysGenerateConnectionGraph
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:102
Scope: file
Source code excerpt:
TEXT("When enabled, always generate a game thread side collision for clusters.[def: true]"));
bool bGeometryCollectionAlwaysGenerateConnectionGraph = false;
FAutoConsoleVariableRef CVarGeometryCollectionAlwaysGenerateConnectionGraph(
TEXT("p.GeometryCollection.AlwaysGenerateConnectionGraph"),
bGeometryCollectionAlwaysGenerateConnectionGraph,
TEXT("When enabled, always generate the cluster's connection graph instead of using the rest collection stored one - Note: this should only be used for troubleshooting.[def: false]"));
int32 GeometryCollectionAreaBasedDamageThresholdMode = 0;
FAutoConsoleVariableRef CVarGeometryCollectionAreaBasedDamageThresholdMode(
TEXT("p.GeometryCollection.AreaBasedDamageThresholdMode"),
GeometryCollectionAreaBasedDamageThresholdMode,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:1545
Scope (from outer to inner):
file
function void FGeometryCollectionPhysicsProxy::InitializeBodiesPT
Source code excerpt:
const GeometryCollection::Facades::FCollectionConnectionGraphFacade ConnectionFacade(*RestCollection);
const bool bGenerateConnectionGraph = !ConnectionFacade.IsValid() || bGeometryCollectionAlwaysGenerateConnectionGraph || !ConnectionFacade.HasValidConnections();
if (bGenerateConnectionGraph)
{
// Set cluster connectivity. TPBDRigidClustering::CreateClusterParticle()
// will optionally do this, but we switch that functionality off in BuildClusters_Internal().
for (int32 ParticleIndex = 0; ParticleIndex < NumEffectiveParticles; ++ParticleIndex)
{