p.UnionsHaveCollisionParticles
p.UnionsHaveCollisionParticles
#Overview
name: p.UnionsHaveCollisionParticles
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.UnionsHaveCollisionParticles is to control whether union clusters in the Chaos physics system should have collision particles. This setting is part of the experimental Chaos physics engine in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Chaos physics system, specifically within the rigid clustering functionality. This can be seen from the file location and namespace where the variable is defined and used.
The value of this variable is set through a console variable. It is initialized to 0 and can be changed at runtime using the console command “p.UnionsHaveCollisionParticles”.
The associated variable UnionsHaveCollisionParticles interacts directly with p.UnionsHaveCollisionParticles. They share the same value, with UnionsHaveCollisionParticles being the actual integer variable used in the code.
Developers must be aware that this variable affects the behavior of cluster creation in the Chaos physics system. When enabled (set to a non-zero value), it causes union clusters to have collision particles, which can impact performance and physics simulation accuracy.
Best practices when using this variable include:
- Use it cautiously, as it may have performance implications.
- Test thoroughly with both enabled and disabled states to ensure desired physics behavior.
- Consider leaving it disabled (0) by default unless there’s a specific need for union clusters to have collision particles.
Regarding the associated variable UnionsHaveCollisionParticles:
- It is the actual integer variable used in the code to store the value set by p.UnionsHaveCollisionParticles.
- It is used in the ShouldUnionsHaveCollisionParticles() function to determine if unions should have collision particles.
- In the CreateClusterParticleFromClusterChildren function, it’s used to set the bCopyCollisionParticles parameter when creating cluster particles.
Developers should treat UnionsHaveCollisionParticles as a read-only variable within their code, relying on the console variable p.UnionsHaveCollisionParticles to modify its value when needed.
#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:544
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
int32 UnionsHaveCollisionParticles = 0;
FAutoConsoleVariableRef CVarUnionsHaveCollisionParticles(TEXT("p.UnionsHaveCollisionParticles"), UnionsHaveCollisionParticles, TEXT(""));
bool
FRigidClustering::ShouldUnionsHaveCollisionParticles()
{
return !!UnionsHaveCollisionParticles;
}
#Associated Variable and Callsites
This variable is associated with another variable named UnionsHaveCollisionParticles
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:543
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
}
int32 UnionsHaveCollisionParticles = 0;
FAutoConsoleVariableRef CVarUnionsHaveCollisionParticles(TEXT("p.UnionsHaveCollisionParticles"), UnionsHaveCollisionParticles, TEXT(""));
bool
FRigidClustering::ShouldUnionsHaveCollisionParticles()
{
return !!UnionsHaveCollisionParticles;
}
DECLARE_CYCLE_STAT(TEXT("TPBDRigidClustering<>::CreateClusterParticleFromClusterChildren"), STAT_CreateClusterParticleFromClusterChildren, STATGROUP_Chaos);
Chaos::FPBDRigidClusteredParticleHandle*
FRigidClustering::CreateClusterParticleFromClusterChildren(
TArray<FPBDRigidParticleHandle*>&& Children,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidClustering.cpp:625
Scope (from outer to inner):
file
namespace Chaos
function Chaos::FPBDRigidClusteredParticleHandle* FRigidClustering::CreateClusterParticleFromClusterChildren
Source code excerpt:
FClusterCreationParameters NoCleanParams = Parameters;
NoCleanParams.bCleanCollisionParticles = false;
NoCleanParams.bCopyCollisionParticles = !!UnionsHaveCollisionParticles;
TSet<FPBDRigidParticleHandle*> ChildrenSet(ChildrenArray);
UpdateClusterMassProperties(NewParticle, ChildrenSet);
MoveClusterToMassOffset(NewParticle, EMassOffsetType::Position);