p.Chaos.CheckForInterclusterEdgesOnRelease
p.Chaos.CheckForInterclusterEdgesOnRelease
#Overview
name: p.Chaos.CheckForInterclusterEdgesOnRelease
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to check for intercluster edges when removing a child from its parent cluster so that we can add the particle back into a cluster union.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.CheckForInterclusterEdgesOnRelease is to control whether the Chaos physics system checks for intercluster edges when removing a child particle from its parent cluster. This setting is primarily used in the rigid body clustering system within Unreal Engine’s Chaos physics module.
This setting variable is relied upon by the Chaos physics subsystem, specifically within the rigid clustering functionality. It’s used in the Experimental/Chaos module of Unreal Engine.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console. Its default value is set to true.
The associated variable bCheckForInterclusterEdgesOnRelease directly interacts with p.Chaos.CheckForInterclusterEdgesOnRelease. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the behavior of cluster breaking in the physics simulation. When set to true, it allows for more complex and potentially more realistic cluster breaking behavior, but may also increase computational cost.
Best practices when using this variable include:
- Consider performance implications when enabling this feature, especially in scenes with many clustered objects.
- Use in conjunction with other clustering-related settings for fine-tuned control over cluster behavior.
- Test thoroughly with both true and false values to understand the impact on your specific use case.
Regarding the associated variable bCheckForInterclusterEdgesOnRelease:
The purpose of bCheckForInterclusterEdgesOnRelease is the same as p.Chaos.CheckForInterclusterEdgesOnRelease. It’s used directly in the C++ code to control the behavior of cluster breaking.
This variable is used within the FRigidClustering class, specifically in methods like HandleConnectivityOnReleaseClusterParticle and AdvanceClustering.
The value of this variable is set by the console variable p.Chaos.CheckForInterclusterEdgesOnRelease.
It interacts closely with other clustering-related variables and functions within the Chaos physics system.
Developers should be aware that this variable directly controls flow in critical clustering logic. Changing its value can significantly alter the behavior of clustered objects in the physics simulation.
Best practices include:
- Use this variable in conjunction with p.Chaos.CheckForInterclusterEdgesOnRelease for consistency.
- Be cautious when modifying this variable’s value during runtime, as it can have immediate effects on ongoing simulations.
- Consider the performance implications of enabling this feature, especially in complex scenes with many clustered objects.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:40
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
bool bCheckForInterclusterEdgesOnRelease = true;
FAutoConsoleVariableRef CVarCheckForInterclusterEdgesOnRelease(TEXT("p.Chaos.CheckForInterclusterEdgesOnRelease"), bCheckForInterclusterEdgesOnRelease, TEXT("Whether to check for intercluster edges when removing a child from its parent cluster so that we can add the particle back into a cluster union."));
bool bOnlyUseInterclusterEdgesAttachedToMainParticles = true;
FAutoConsoleVariableRef CVarOnlyUseInterclusterEdgesAttachedToMainParticles(TEXT("p.Chaos.OnlyUseInterclusterEdgesAttachedToMainParticles"), bOnlyUseInterclusterEdgesAttachedToMainParticles, TEXT("If true, an intercluster edge must be directly attached to a main particle for the particle to remain a part of the cluster union."));
int32 ComputeClusterCollisionStrains = 1;
FAutoConsoleVariableRef CVarComputeClusterCollisionStrains(TEXT("p.ComputeClusterCollisionStrains"), ComputeClusterCollisionStrains, TEXT("Whether to use collision constraints when processing clustering."));
#Associated Variable and Callsites
This variable is associated with another variable named bCheckForInterclusterEdgesOnRelease
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:39
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarUseConnectivity(TEXT("p.UseConnectivity"), UseConnectivity, TEXT("Whether to use connectivity graph when breaking up clusters"));
bool bCheckForInterclusterEdgesOnRelease = true;
FAutoConsoleVariableRef CVarCheckForInterclusterEdgesOnRelease(TEXT("p.Chaos.CheckForInterclusterEdgesOnRelease"), bCheckForInterclusterEdgesOnRelease, TEXT("Whether to check for intercluster edges when removing a child from its parent cluster so that we can add the particle back into a cluster union."));
bool bOnlyUseInterclusterEdgesAttachedToMainParticles = true;
FAutoConsoleVariableRef CVarOnlyUseInterclusterEdgesAttachedToMainParticles(TEXT("p.Chaos.OnlyUseInterclusterEdgesAttachedToMainParticles"), bOnlyUseInterclusterEdgesAttachedToMainParticles, TEXT("If true, an intercluster edge must be directly attached to a main particle for the particle to remain a part of the cluster union."));
int32 ComputeClusterCollisionStrains = 1;
FAutoConsoleVariableRef CVarComputeClusterCollisionStrains(TEXT("p.ComputeClusterCollisionStrains"), ComputeClusterCollisionStrains, TEXT("Whether to use collision constraints when processing clustering."));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1372
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
IslandInterclusterEdges.Reserve(Islands.Num());
// By default, all these islands will all just start simulating independently. However, if bCheckForInterclusterEdgesOnRelease
// is true, we're going to want to check if any of these islands contain a particle with an intercluster edge that connects to
// something else! In that case, keep the particles in the island connected. For simplicity
// we'll use a kinematic target for each group of particles that needs to stay attached . This kinematic target
// will be driven by simulation relative to whatever it should be attached to.
//
// We need to assume that only the server will have the intercluster edges necessary to drive this kinematic target. Therefore, this
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1399
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
// Protect a potentially work-intensive loop behind the conditions that actually require us to step through every child in every island.
if (bNeedRecomputeConnectivityStrain || bCheckForInterclusterEdgesOnRelease)
{
for (FPBDRigidParticleHandle* ChildParticle : Island)
{
if (FPBDRigidClusteredParticleHandle* ClusteredChild = ChildParticle->CastToClustered())
{
// recompute the strain as its connectivity has changed
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1411
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
}
if (bCheckForInterclusterEdgesOnRelease && !AttachedClusterUnion)
{
// Check if any edge is connected to "something else". This entire island
// will be connected to that "something else". For now, we're enforcing that it's a cluster union.
for (const FConnectivityEdge& Edge : ClusteredChild->ConnectivityEdges())
{
if (IsInterclusterEdge(*ClusteredChild, Edge))
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1524
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
}
}
else if (bCheckForInterclusterEdgesOnRelease && ParentClusterUnion->bCheckConnectivity)
{
// We know we're in an cluster union. There are pieces that we consider to be the "main body". There are certain pieces that we consider to be auxiliary as well.
// If an island is only made up of auxiliary pieces, then those pieces should fall off. Connectivity of main pieces should be handled by the GT.
for (const FParticleIsland& Island : Islands)
{
bool bHasMainParticle = false;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1879
Scope (from outer to inner):
file
namespace Chaos
function void FRigidClustering::AdvanceClustering
Source code excerpt:
}
if (bCheckForInterclusterEdgesOnRelease)
{
// In this case the breaking model might have tried to *add* into cluster unions so we need to flush those operations here as well
// so those changes are immediately available for marshaling back to the GT.
ClusterUnionManager.FlushPendingOperations();
}