p.Chaos.OnlyUseInterclusterEdgesAttachedToMainParticles
p.Chaos.OnlyUseInterclusterEdgesAttachedToMainParticles
#Overview
name: p.Chaos.OnlyUseInterclusterEdgesAttachedToMainParticles
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, an intercluster edge must be directly attached to a main particle for the particle to remain a part of the cluster union.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.OnlyUseInterclusterEdgesAttachedToMainParticles is to control the behavior of intercluster edge connections in the Chaos physics system, specifically for rigid body clustering.
This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics framework. It’s referenced in the PBDRigidClustering.cpp file, indicating its relevance to the Position Based Dynamics (PBD) rigid clustering subsystem.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through the console. It’s initialized to true by default.
This variable interacts closely with its associated boolean variable bOnlyUseInterclusterEdgesAttachedToMainParticles. They share the same value and are used interchangeably in the code.
Developers must be aware that when this variable is set to true, it affects how particles are added to cluster unions. Specifically, it requires that an intercluster edge must be directly attached to a main particle for the particle to remain part of the cluster union.
Best practices when using this variable include:
- Consider the performance implications of enabling or disabling this feature, as it may affect the complexity of cluster calculations.
- Test thoroughly with both true and false values to understand the impact on your specific use case.
- Use in conjunction with other clustering-related variables for fine-tuned control over the physics simulation.
Regarding the associated variable bOnlyUseInterclusterEdgesAttachedToMainParticles:
- It’s used directly in the code to control the logic for handling connectivity when releasing cluster particles.
- When true, it causes the system to be more selective about which particles are added to the cluster union, potentially reducing the number of connections and simplifying the cluster structure.
- It’s used in multiple places within the HandleConnectivityOnReleaseClusterParticle function to determine whether to add particles to a cluster union or to release them.
- Developers should be aware that changing this variable could significantly affect the behavior of cluster breaking and reformation in the physics simulation.
#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:43
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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."));
int32 DeactivateClusterChildren = 0;
FAutoConsoleVariableRef CVarDeactivateClusterChildren(TEXT("p.DeactivateClusterChildren"), DeactivateClusterChildren, TEXT("If children should be decativated when broken and put into another cluster."));
#Associated Variable and Callsites
This variable is associated with another variable named bOnlyUseInterclusterEdgesAttachedToMainParticles
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:42
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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."));
int32 DeactivateClusterChildren = 0;
FAutoConsoleVariableRef CVarDeactivateClusterChildren(TEXT("p.DeactivateClusterChildren"), DeactivateClusterChildren, TEXT("If children should be decativated when broken and put into another cluster."));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1442
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
TArray<FPBDRigidParticleHandle*> ParticlesToRelease;
if (bOnlyUseInterclusterEdgesAttachedToMainParticles)
{
ParticlesForClusterUnion.Reserve(Island.Num());
ParticlesToRelease.Reserve(Island.Num());
}
for (FPBDRigidParticleHandle* ChildParticle : Island)
{
if (bOnlyUseInterclusterEdgesAttachedToMainParticles)
{
if (ClusterUnionManager.IsDirectlyConnectedToMainParticleInClusterUnion(*AttachedClusterUnion, ChildParticle))
{
ParticlesForClusterUnion.Add(ChildParticle);
}
else
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1467
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
AttachedClusterUnion->ChildProperties.Add(ChildParticle, Properties);
}
ClusterUnionManager.AddPendingClusterIndexOperation(AttachedClusterUnion->InternalIndex, EClusterUnionOperation::Add, bOnlyUseInterclusterEdgesAttachedToMainParticles ? ParticlesForClusterUnion : Island);
if (!ParticlesToRelease.IsEmpty())
{
for (FPBDRigidParticleHandle* ChildParticle : ParticlesToRelease)
{
// Need to remove node connections here. Otherwise it may be possible for the cluster union to have erroneous intercluster edges that connect it to another cluster union.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:1546
Scope (from outer to inner):
file
namespace Chaos
function TSet<FPBDRigidParticleHandle*> FRigidClustering::HandleConnectivityOnReleaseClusterParticle
Source code excerpt:
}
if (bOnlyUseInterclusterEdgesAttachedToMainParticles)
{
if (!ClusterUnionManager.IsDirectlyConnectedToMainParticleInClusterUnion(*ParentClusterUnion, ChildParticle))
{
ParticlesToRemove.Add(ChildParticle);
}
}