p.Chaos.ClusterUnion.GenerateInterclusterEdges
p.Chaos.ClusterUnion.GenerateInterclusterEdges
#Overview
name: p.Chaos.ClusterUnion.GenerateInterclusterEdges
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to generate intercluster edges automatically when adding to a cluster union (and remove them when removing from the cluster union).
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.ClusterUnion.GenerateInterclusterEdges is to control the automatic generation of intercluster edges when adding particles to a cluster union in the Chaos physics system of Unreal Engine 5. This setting variable is specifically related to the physics simulation and clustering system within the Chaos framework.
This setting variable is primarily used in the Chaos module of Unreal Engine 5, which is part of the experimental physics system. Based on the callsites, it’s clear that this variable is utilized within the ClusterUnionManager.cpp file, which is responsible for managing cluster unions in the Chaos physics system.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through the console. Its default value is set to true.
The associated variable bChaosClusterUnionGenerateInterclusterEdges directly interacts with p.Chaos.ClusterUnion.GenerateInterclusterEdges. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the behavior of cluster unions in the Chaos physics system. When set to true, it automatically generates intercluster edges when adding particles to a cluster union and removes them when removing particles from the union. This can have implications for performance and simulation accuracy.
Best practices when using this variable include:
- Consider the performance impact of generating intercluster edges, especially in scenarios with many particles or complex cluster structures.
- Test the simulation behavior with both true and false settings to determine the optimal configuration for your specific use case.
- Be aware that changing this setting may require adjustments to other parts of your physics simulation setup.
Regarding the associated variable bChaosClusterUnionGenerateInterclusterEdges:
- Its purpose is the same as p.Chaos.ClusterUnion.GenerateInterclusterEdges, serving as the actual boolean flag used in the code.
- It’s used directly in conditional statements within the Chaos module to determine whether to generate intercluster edges.
- The value is set by the console variable p.Chaos.ClusterUnion.GenerateInterclusterEdges.
- It interacts closely with the cluster union management system and affects the behavior of adding and removing particles from cluster unions.
- Developers should be aware that this variable directly controls the generation of intercluster edges in the code.
- Best practices include using this variable consistently throughout the codebase and ensuring that its value is properly synchronized with the console variable when making manual modifications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ClusterUnionManager.cpp:19
Scope (from outer to inner):
file
namespace Chaos
namespace anonymous
Source code excerpt:
bool bChaosClusterUnionGenerateInterclusterEdges = true;
FAutoConsoleVariableRef CVarChaosClusterUnionGenerateInterclusterEdges(
TEXT("p.Chaos.ClusterUnion.GenerateInterclusterEdges"),
bChaosClusterUnionGenerateInterclusterEdges,
TEXT("Whether to generate intercluster edges automatically when adding to a cluster union (and remove them when removing from the cluster union).")
);
// @tmp: To be removed
bool bChaosClusterUnionDoNotAddEmptyClusters = true;
#Associated Variable and Callsites
This variable is associated with another variable named bChaosClusterUnionGenerateInterclusterEdges
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ClusterUnionManager.cpp:17
Scope (from outer to inner):
file
namespace Chaos
namespace anonymous
Source code excerpt:
namespace
{
bool bChaosClusterUnionGenerateInterclusterEdges = true;
FAutoConsoleVariableRef CVarChaosClusterUnionGenerateInterclusterEdges(
TEXT("p.Chaos.ClusterUnion.GenerateInterclusterEdges"),
bChaosClusterUnionGenerateInterclusterEdges,
TEXT("Whether to generate intercluster edges automatically when adding to a cluster union (and remove them when removing from the cluster union).")
);
// @tmp: To be removed
bool bChaosClusterUnionDoNotAddEmptyClusters = true;
FAutoConsoleVariableRef CVarChaosClusterUnionDoNotAddEmptyClusters(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ClusterUnionManager.cpp:165
Scope (from outer to inner):
file
namespace anonymous
function void AddParticleToConnectionGraph
lambda-function
Source code excerpt:
}
if (bChaosClusterUnionGenerateInterclusterEdges && Particle && OtherParticle)
{
// Only generate intercluster edges for main particles. Auxiliary particles that are just bits and pieces of geometry collections
// shouldn't also generate intercluster edges.
if (!Properties || !Properties->bIsAuxiliaryParticle)
{
const TArray<FPBDRigidParticleHandle*>& ParticleChildren = Clustering.GetChildrenMap().FindRef(Particle->CastToClustered());
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ClusterUnionManager.cpp:205
Scope (from outer to inner):
file
namespace Chaos
namespace anonymous
function void RemoveClusterUnionEdges
Source code excerpt:
Clustering.RemoveNodeConnections(ParticleHandle);
if (bChaosClusterUnionGenerateInterclusterEdges)
{
if (FPBDRigidClusteredParticleHandle* ClusterParticle = ParticleHandle->CastToClustered())
{
if (TArray<FPBDRigidParticleHandle*>* AllChildren = Clustering.GetChildrenMap().Find(ClusterParticle))
{
for (FPBDRigidParticleHandle* Child : *AllChildren)