p.GeometryCollection.AreaBasedDamageThresholdMode
p.GeometryCollection.AreaBasedDamageThresholdMode
#Overview
name: p.GeometryCollection.AreaBasedDamageThresholdMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Area based damage threshold computation mode (0: sum of areas | 1: max of areas | 2: min of areas | 3: average of areas) [def: 0]
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.GeometryCollection.AreaBasedDamageThresholdMode is to control the computation mode for area-based damage thresholds in Geometry Collections within Unreal Engine 5’s physics system.
This setting variable is primarily used in the Chaos physics system, specifically within the Geometry Collection physics proxy. It is part of the experimental Chaos module, which is responsible for advanced physics simulations in Unreal Engine 5.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. It is initialized with a default value of 0.
The associated variable GeometryCollectionAreaBasedDamageThresholdMode directly interacts with p.GeometryCollection.AreaBasedDamageThresholdMode. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects how damage thresholds are computed for Geometry Collections. The variable supports four modes: 0: Sum of areas 1: Max of areas 2: Min of areas 3: Average of areas
When using this variable, developers should consider the following best practices:
- Understand the implications of each mode on the physics behavior of Geometry Collections.
- Test different modes to find the most suitable one for their specific use case.
- Be cautious when changing this value at runtime, as it may significantly affect the physics simulation.
- Document the chosen mode and its rationale in the project documentation.
Regarding the associated variable GeometryCollectionAreaBasedDamageThresholdMode:
- It is an int32 variable that directly represents the mode selected by p.GeometryCollection.AreaBasedDamageThresholdMode.
- It is used in the ComputeMaterialBasedDamageThreshold_Internal function of the FGeometryCollectionPhysicsProxy class to determine how to calculate damage thresholds.
- Developers should treat this variable as read-only within their code, as its value is set by the console variable system.
- When accessing this variable in performance-critical sections, it’s advisable to cache its value locally to avoid potential overhead from repeated access to the console variable system.
#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:110
Scope: file
Source code excerpt:
int32 GeometryCollectionAreaBasedDamageThresholdMode = 0;
FAutoConsoleVariableRef CVarGeometryCollectionAreaBasedDamageThresholdMode(
TEXT("p.GeometryCollection.AreaBasedDamageThresholdMode"),
GeometryCollectionAreaBasedDamageThresholdMode,
TEXT("Area based damage threshold computation mode (0: sum of areas | 1: max of areas | 2: min of areas | 3: average of areas) [def: 0]"));
int32 GeometryCollectionLocalInertiaDropOffDiagonalTerms = 0;
FAutoConsoleVariableRef CVarGeometryCollectionLocalInertiaDropOffDiagonalTerms(
TEXT("p.GeometryCollection.LocalInertiaDropOffDiagonalTerms"),
#Associated Variable and Callsites
This variable is associated with another variable named GeometryCollectionAreaBasedDamageThresholdMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:108
Scope: file
Source code excerpt:
TEXT("When enabled, always generate the cluster's connection graph instead of using the rest collection stored one - Note: this should only be used for troubleshooting.[def: false]"));
int32 GeometryCollectionAreaBasedDamageThresholdMode = 0;
FAutoConsoleVariableRef CVarGeometryCollectionAreaBasedDamageThresholdMode(
TEXT("p.GeometryCollection.AreaBasedDamageThresholdMode"),
GeometryCollectionAreaBasedDamageThresholdMode,
TEXT("Area based damage threshold computation mode (0: sum of areas | 1: max of areas | 2: min of areas | 3: average of areas) [def: 0]"));
int32 GeometryCollectionLocalInertiaDropOffDiagonalTerms = 0;
FAutoConsoleVariableRef CVarGeometryCollectionLocalInertiaDropOffDiagonalTerms(
TEXT("p.GeometryCollection.LocalInertiaDropOffDiagonalTerms"),
GeometryCollectionLocalInertiaDropOffDiagonalTerms,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:1802
Scope (from outer to inner):
file
function float FGeometryCollectionPhysicsProxy::ComputeMaterialBasedDamageThreshold_Internal
Source code excerpt:
// store in a local variable outisde of the loop , to make sure the compiler knows we are knot going to change it while in the loop
const int32 ComputationMode = GeometryCollectionAreaBasedDamageThresholdMode;
const Chaos::FConnectivityEdgeArray& ConnectivityEdges = ClusteredParticle.ConnectivityEdges();
for (const Chaos::FConnectivityEdge& Connection : ConnectivityEdges)
{
switch (ComputationMode)
{