p.GeometryCollection.ScaleClusterGeometry
p.GeometryCollection.ScaleClusterGeometry
#Overview
name: p.GeometryCollection.ScaleClusterGeometry
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If enabled, update the cluster geometry if the scale has changed
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.GeometryCollection.ScaleClusterGeometry is to control whether the cluster geometry in a Geometry Collection should be updated when its scale changes. This setting is primarily used in the physics system, specifically for Geometry Collections, which are part of Unreal Engine’s Chaos physics engine.
This setting variable is relied upon by the Experimental Chaos module, which is part of Unreal Engine’s physics system. It’s specifically used in the GeometryCollectionPhysicsProxy, which handles the physics representation of Geometry Collections.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through the console. By default, it’s set to true.
The associated variable bGeometryCollectionScaleClusterGeometry directly interacts with this console variable. They share the same value, with bGeometryCollectionScaleClusterGeometry being used in the actual code logic.
Developers must be aware that this variable affects performance and visual accuracy. When enabled, it ensures that the physics representation of clustered geometry accurately reflects any scale changes, but this comes at a performance cost as it requires updating the geometry.
Best practices when using this variable include:
- Keep it enabled (default) for most scenarios to ensure visual accuracy.
- Consider disabling it in performance-critical situations where slight inaccuracies in scaled clustered geometry are acceptable.
- Test thoroughly with both settings to understand the impact on your specific use case.
Regarding the associated variable bGeometryCollectionScaleClusterGeometry:
- Its purpose is the same as p.GeometryCollection.ScaleClusterGeometry, serving as the in-code representation of the setting.
- It’s used directly in the GeometryCollectionPhysicsProxy’s SetWorldTransform_Internal function to determine whether to update the cluster geometry when a scale change is detected.
- The value is set by the console variable and can be accessed throughout the relevant code.
- Developers should treat this variable as read-only within their code, allowing it to be controlled via the console variable for consistency.
- Best practices include using this variable for conditional logic related to cluster geometry scaling, and ensuring that any code depending on this behavior is prepared to handle both true and false cases.
#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:152
Scope: file
Source code excerpt:
bool bGeometryCollectionScaleClusterGeometry = true;
FAutoConsoleVariableRef CVarGeometryCollectionScaleClusterGeometry(
TEXT("p.GeometryCollection.ScaleClusterGeometry"),
bGeometryCollectionScaleClusterGeometry,
TEXT("If enabled, update the cluster geometry if the scale has changed"));
enum EOverrideGCCollisionSetupForTraces
{
GCCSFT_Property = -1, // Default: do what property says
#Associated Variable and Callsites
This variable is associated with another variable named bGeometryCollectionScaleClusterGeometry
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:150
Scope: file
Source code excerpt:
TEXT("If enabled, disabled internal clusters will propagate their disabled flag to their children when buffering instead of implicitly activating the children."));
bool bGeometryCollectionScaleClusterGeometry = true;
FAutoConsoleVariableRef CVarGeometryCollectionScaleClusterGeometry(
TEXT("p.GeometryCollection.ScaleClusterGeometry"),
bGeometryCollectionScaleClusterGeometry,
TEXT("If enabled, update the cluster geometry if the scale has changed"));
enum EOverrideGCCollisionSetupForTraces
{
GCCSFT_Property = -1, // Default: do what property says
GCCSFT_ForceSM = 0, // Force the use of SM collision
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:3345
Scope (from outer to inner):
file
function void FGeometryCollectionPhysicsProxy::SetWorldTransform_Internal
Source code excerpt:
}
}
if (bGeometryCollectionScaleClusterGeometry)
{
const FVector ScaleRatio = Parameters.WorldTransform.GetScale3D() / Parameters.PrevWorldTransform.GetScale3D();
if (!ScaleRatio.Equals(FVector::OneVector))
{
ScaleClusterGeometry_Internal(ScaleRatio);
}