p.GeometryCollection.ScaleClusterGeometry

p.GeometryCollection.ScaleClusterGeometry

#Overview

name: p.GeometryCollection.ScaleClusterGeometry

This variable is created as a Console Variable (cvar).

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:

  1. Keep it enabled (default) for most scenarios to ensure visual accuracy.
  2. Consider disabling it in performance-critical situations where slight inaccuracies in scaled clustered geometry are acceptable.
  3. Test thoroughly with both settings to understand the impact on your specific use case.

Regarding the associated variable bGeometryCollectionScaleClusterGeometry:

#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);
		}