p.GeometryCollection.LocalInertiaDropOffDiagonalTerms

p.GeometryCollection.LocalInertiaDropOffDiagonalTerms

#Overview

name: p.GeometryCollection.LocalInertiaDropOffDiagonalTerms

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.LocalInertiaDropOffDiagonalTerms is to control the inertia calculation for Geometry Collections in Unreal Engine’s physics system, specifically in the Chaos physics engine.

This setting variable is primarily used in the Chaos physics module, which is part of Unreal Engine’s experimental physics simulation system. It is referenced in the GeometryCollectionPhysicsProxy.cpp file, indicating its relevance to the Geometry Collection physics proxy.

The value of this variable is set through the Unreal Engine console variable system. It is initialized as an integer with a default value of 0 and can be modified at runtime.

The associated variable GeometryCollectionLocalInertiaDropOffDiagonalTerms directly interacts with p.GeometryCollection.LocalInertiaDropOffDiagonalTerms. They share the same value and purpose.

Developers must be aware that when this variable is set to a non-zero value, it forces diagonal inertia for Geometry Collections in their local space by dropping off-diagonal terms. This can significantly affect the physics behavior of Geometry Collections.

Best practices when using this variable include:

  1. Understanding the implications of forcing diagonal inertia on your specific use case.
  2. Testing thoroughly with both zero and non-zero values to ensure desired physics behavior.
  3. Using this setting judiciously, as it can impact performance and simulation accuracy.
  4. Documenting any non-default usage of this variable in your project to maintain consistency across the development team.

Regarding the associated variable GeometryCollectionLocalInertiaDropOffDiagonalTerms:

The purpose of this variable is identical to p.GeometryCollection.LocalInertiaDropOffDiagonalTerms, as they share the same value and functionality.

It is used directly in the code to check whether to adjust cluster inertia by dropping off-diagonal terms. This occurs within the InitializeSharedCollisionStructures function of the FGeometryCollectionPhysicsProxy class.

The value of this variable is set by the console variable system, mirroring p.GeometryCollection.LocalInertiaDropOffDiagonalTerms.

Developers should be aware that this variable directly impacts the physics calculations for Geometry Collections. When non-zero, it triggers the AdjustClusterInertia function with the LocalInertiaDropOffDiagonalTerms operation.

Best practices for this variable are the same as for p.GeometryCollection.LocalInertiaDropOffDiagonalTerms, as they are effectively the same setting.

#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:116

Scope: file

Source code excerpt:

int32 GeometryCollectionLocalInertiaDropOffDiagonalTerms = 0;
FAutoConsoleVariableRef CVarGeometryCollectionLocalInertiaDropOffDiagonalTerms(
	TEXT("p.GeometryCollection.LocalInertiaDropOffDiagonalTerms"),
	GeometryCollectionLocalInertiaDropOffDiagonalTerms,
	TEXT("When true, force diagonal inertia for GCs in their local space by simply dropping off-diagonal terms"));

float GeometryCollectionTransformTolerance = 0.001f;
FAutoConsoleVariableRef CVarGeometryCollectionTransformTolerance(
	TEXT("p.GeometryCollection.TransformTolerance"),

#Associated Variable and Callsites

This variable is associated with another variable named GeometryCollectionLocalInertiaDropOffDiagonalTerms. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:114

Scope: file

Source code excerpt:

	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,
	TEXT("When true, force diagonal inertia for GCs in their local space by simply dropping off-diagonal terms"));

float GeometryCollectionTransformTolerance = 0.001f;
FAutoConsoleVariableRef CVarGeometryCollectionTransformTolerance(
	TEXT("p.GeometryCollection.TransformTolerance"),
	GeometryCollectionTransformTolerance,

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PhysicsProxy/GeometryCollectionPhysicsProxy.cpp:5347

Scope (from outer to inner):

file
function     void FGeometryCollectionPhysicsProxy::InitializeSharedCollisionStructures

Source code excerpt:

				// when there's a mass rotation. The problem should go away once we remove MassToLocal
				// and replace it with regular old CenterOfMass and RotationOfMass.
				if (GeometryCollectionLocalInertiaDropOffDiagonalTerms)
				{
					AdjustClusterInertia(ClusterHandle, EInertiaOperations::LocalInertiaDropOffDiagonalTerms);
				}

				// Zero out CoM and RoM, and update XR accordingly so that when UpdateClusterMassProperties
				// is called in the next level up with ClusterHandle as one of the the children it's XR will