p.CollisionParticlesPerObjectFractionDefault
p.CollisionParticlesPerObjectFractionDefault
#Overview
name: p.CollisionParticlesPerObjectFractionDefault
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Fraction of verts
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.CollisionParticlesPerObjectFractionDefault is to control the fraction of vertices used for collision detection in Geometry Collection objects within Unreal Engine 5’s Chaos physics system.
- This setting variable is part of the Chaos physics system, specifically for Geometry Collection objects.
- The Chaos physics module and the Geometry Collection system rely on this setting variable.
- The value of this variable is set as a console variable, which means it can be changed at runtime or through configuration files.
- It interacts with the CollisionParticlesPerObjectFraction variable, which is initialized using this default value.
- Developers must be aware that this variable affects the performance and accuracy of collision detection for Geometry Collection objects. A higher value means more vertices are used for collision, increasing accuracy but potentially impacting performance.
- Best practices when using this variable include:
- Adjusting it based on the complexity of your Geometry Collection objects and performance requirements.
- Testing different values to find the optimal balance between collision accuracy and performance.
- Considering using different values for different levels of detail or based on the object’s distance from the camera.
Regarding the associated variable CollisionParticlesPerObjectFractionDefault:
- Its purpose is to store the actual value used by the physics system for collision particle fraction.
- It’s initialized with the value of p.CollisionParticlesPerObjectFractionDefault.
- It’s used in the FGeometryCollectionPhysicsProxy constructor to set the CollisionParticlesPerObjectFraction member variable.
- In the Initialize function of FGeometryCollectionPhysicsProxy, it’s combined with the CollisionSampleFraction parameter to calculate the final CollisionParticlesPerObjectFraction.
- Developers should be aware that changes to p.CollisionParticlesPerObjectFractionDefault will affect newly created Geometry Collection objects, but won’t immediately affect existing ones.
- Best practices include:
- Monitoring this value when debugging collision issues with Geometry Collection objects.
- Considering it when optimizing performance, as it directly affects the number of collision particles used.
- Potentially exposing it as a configurable parameter for artists or level designers to fine-tune collision behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:73
Scope: file
Source code excerpt:
float CollisionParticlesPerObjectFractionDefault = 1.0f;
FAutoConsoleVariableRef CVarCollisionParticlesPerObjectFractionDefault(
TEXT("p.CollisionParticlesPerObjectFractionDefault"),
CollisionParticlesPerObjectFractionDefault,
TEXT("Fraction of verts"));
bool DisableGeometryCollectionGravity = false;
FAutoConsoleVariableRef CVarGeometryCollectionDisableGravity(
TEXT("p.GeometryCollectionDisableGravity"),
#Associated Variable and Callsites
This variable is associated with another variable named CollisionParticlesPerObjectFractionDefault
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:71
Scope: file
Source code excerpt:
}
float CollisionParticlesPerObjectFractionDefault = 1.0f;
FAutoConsoleVariableRef CVarCollisionParticlesPerObjectFractionDefault(
TEXT("p.CollisionParticlesPerObjectFractionDefault"),
CollisionParticlesPerObjectFractionDefault,
TEXT("Fraction of verts"));
bool DisableGeometryCollectionGravity = false;
FAutoConsoleVariableRef CVarGeometryCollectionDisableGravity(
TEXT("p.GeometryCollectionDisableGravity"),
DisableGeometryCollectionGravity,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:523
Scope (from outer to inner):
file
function FGeometryCollectionPhysicsProxy::FGeometryCollectionPhysicsProxy
Source code excerpt:
, LastSyncCountGT(MAX_uint32)
#endif
, CollisionParticlesPerObjectFraction(CollisionParticlesPerObjectFractionDefault)
, PhysicsThreadCollection(Parameters.RestCollection)
, GameThreadCollection(GameThreadCollectionIn)
, WorldTransform_External(FTransform::Identity)
, bIsGameThreadWorldTransformDirty(false)
, bHasBuiltGeometryOnPT(false)
, bHasBuiltGeometryOnGT(false)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:612
Scope (from outer to inner):
file
function void FGeometryCollectionPhysicsProxy::Initialize
Source code excerpt:
// Collision vertices down sampling validation.
//
CollisionParticlesPerObjectFraction = Parameters.CollisionSampleFraction * CollisionParticlesPerObjectFractionDefault;
if (ReportHighParticleFraction > 0)
{
for (const FSharedSimulationSizeSpecificData& Data : Parameters.Shared.SizeSpecificData)
{
if (ensure(Data.CollisionShapesData.Num()))
{