p.DeactivateClusterChildren
p.DeactivateClusterChildren
#Overview
name: p.DeactivateClusterChildren
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If children should be decativated when broken and put into another cluster.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.DeactivateClusterChildren is to control the behavior of child particles when they are broken from their parent cluster and put into another cluster within the Unreal Engine’s Chaos physics system.
This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics module. It is specifically utilized in the rigid body clustering functionality of the physics simulation.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. It is initialized to 0 (false) by default.
The associated variable DeactivateClusterChildren interacts directly with p.DeactivateClusterChildren, as they share the same value. This integer variable is used in the actual logic of the clustering system.
Developers must be aware that when this variable is set to true (1), it will cause child particles to be deactivated when they are broken from their parent cluster and added to a new cluster. This can significantly affect the behavior and performance of the physics simulation, especially in scenarios with complex hierarchical structures of rigid bodies.
Best practices when using this variable include:
- Testing the physics simulation with both true and false values to understand the impact on your specific use case.
- Consider the performance implications, as deactivating children might reduce computational load but could affect the fidelity of the simulation.
- Use in conjunction with other clustering parameters to achieve the desired balance between performance and accuracy.
Regarding the associated variable DeactivateClusterChildren:
- It is used directly in the logic of the FRigidClustering class, specifically in the CreateClusterParticleFromClusterChildren function.
- When true, it causes the physics evolution to disable child particles and remove them from top-level cluster parent collections.
- It affects how the clustering system manages the hierarchy of particles, potentially simplifying the simulation at the cost of some physical accuracy.
Developers should carefully consider the trade-offs between performance and simulation fidelity when adjusting this variable, and test thoroughly in scenarios relevant to their specific game or application.
#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:49
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
int32 DeactivateClusterChildren = 0;
FAutoConsoleVariableRef CVarDeactivateClusterChildren(TEXT("p.DeactivateClusterChildren"), DeactivateClusterChildren, TEXT("If children should be decativated when broken and put into another cluster."));
int32 UseBoundingBoxForConnectionGraphFiltering = 0;
FAutoConsoleVariableRef CVarUseBoundingBoxForConnectionGraphFiltering(TEXT("p.UseBoundingBoxForConnectionGraphFiltering"), UseBoundingBoxForConnectionGraphFiltering, TEXT("when on, use bounding box overlaps to filter connection during the connection graph generation [def: 0]"));
float BoundingBoxMarginForConnectionGraphFiltering = 0;
FAutoConsoleVariableRef CVarBoundingBoxMarginForConnectionGraphFiltering(TEXT("p.BoundingBoxMarginForConnectionGraphFiltering"), BoundingBoxMarginForConnectionGraphFiltering, TEXT("when UseBoundingBoxForConnectionGraphFiltering is on, the margin to use for the oevrlap test [def: 0]"));
#Associated Variable and Callsites
This variable is associated with another variable named DeactivateClusterChildren
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:48
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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."));
int32 UseBoundingBoxForConnectionGraphFiltering = 0;
FAutoConsoleVariableRef CVarUseBoundingBoxForConnectionGraphFiltering(TEXT("p.UseBoundingBoxForConnectionGraphFiltering"), UseBoundingBoxForConnectionGraphFiltering, TEXT("when on, use bounding box overlaps to filter connection during the connection graph generation [def: 0]"));
float BoundingBoxMarginForConnectionGraphFiltering = 0;
FAutoConsoleVariableRef CVarBoundingBoxMarginForConnectionGraphFiltering(TEXT("p.BoundingBoxMarginForConnectionGraphFiltering"), BoundingBoxMarginForConnectionGraphFiltering, TEXT("when UseBoundingBoxForConnectionGraphFiltering is on, the margin to use for the oevrlap test [def: 0]"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:591
Scope (from outer to inner):
file
namespace Chaos
function Chaos::FPBDRigidClusteredParticleHandle* FRigidClustering::CreateClusterParticleFromClusterChildren
Source code excerpt:
TArray<FPBDRigidParticleHandle*>& ChildrenArray = MChildren[NewParticle];
//child transforms are out of date, need to update them. @todo(ocohen): if children transforms are relative we would not need to update this, but would simply have to do a final transform on the new cluster index
// TODO(mlentine): Why is this not needed? (Why is it ok to have DeactivateClusterChildren==false?)
if (DeactivateClusterChildren)
{
//TODO: avoid iteration just pass in a view
TSet<FGeometryParticleHandle*> ChildrenHandles(static_cast<TArray<FGeometryParticleHandle*>>(ChildrenArray));
MEvolution.DisableParticles(ChildrenHandles);
}
bool bClusterIsOneWayInteraction = true;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:609
Scope (from outer to inner):
file
namespace Chaos
function Chaos::FPBDRigidClusteredParticleHandle* FRigidClustering::CreateClusterParticleFromClusterChildren
Source code excerpt:
ClusteredChild->ClusterIds().Id = NewParticle;
ClusteredChild->SetClusterGroupIndex(0);
if (DeactivateClusterChildren)
{
TopLevelClusterParents.Remove(ClusteredChild);
TopLevelClusterParentsStrained.Remove(ClusteredChild);
}
ClusteredChild->SetCollisionImpulses(FMath::Max(NewParticle->CollisionImpulses(), ClusteredChild->CollisionImpulses()));