p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio

p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio

#Overview

name: p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio

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.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio is to control the inertia conditioning system in the Chaos physics solver of Unreal Engine 5. It’s specifically used to limit the inverse inertia components of rigid bodies, which affects their rotational behavior during physics simulations.

This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics framework. It’s referenced in the PBDRigidsEvolutionGBF.cpp file, which is part of the Chaos solver implementation.

The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be modified at runtime using console commands or through engine configuration files.

The associated variable ChaosSolverMaxInvInertiaComponentRatio directly interacts with p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio. They share the same value and are used interchangeably in the code.

Developers must be aware that:

  1. This variable affects the rotational behavior of rigid bodies in physics simulations.
  2. A value greater than 1 will limit the inverse inertia components, making objects behave more like spheres (more “round” in terms of rotation).
  3. Setting it to 0 disables this inertia conditioning feature.

Best practices when using this variable include:

  1. Use it cautiously, as it can significantly affect the realism of physics simulations.
  2. Test different values to find the right balance between performance and desired physical behavior.
  3. Consider disabling it (set to 0) if you need precise control over object rotations or if you’re experiencing unexpected behavior in your physics simulations.

Regarding the associated variable ChaosSolverMaxInvInertiaComponentRatio:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		// If > 1, limits the inverse inertia components to be mo more than this multiple of the smallest component. Makes the objects more round. Set to 0 to disable.
		FRealSingle ChaosSolverMaxInvInertiaComponentRatio = 0;
		FAutoConsoleVariableRef  CVarChaosSolverInertiaConditioningMaxInvInertiaComponentRatio(TEXT("p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio"), ChaosSolverMaxInvInertiaComponentRatio, TEXT("An input to inertia conditioning system. The largest inertia component must be at least least multiple of the smallest component"));

		// Collision modifiers are run after the CCD rewind and manifold regeneration because the CCD "contact" data is only used to rewind the particle 
		// and we regenerate the manifold at that new position. Running the modifier callback before CCD rewind would mean that the user does not have 
		// data related to the actual contacts that will be resolved, and the positions and normals may be misleading. 
		// This cvar allows use to run the modifiers before CCD rewind which is how it used to be, just in case.
		// The new way to disable CCD contacts (pre-rewind) is to do it in a MidPhase- or CCD-Modifier callbacks. See FCCDModifier.

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:113

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		// If > 1, limits the inverse inertia components to be mo more than this multiple of the smallest component. Makes the objects more round. Set to 0 to disable.
		FRealSingle ChaosSolverMaxInvInertiaComponentRatio = 0;
		FAutoConsoleVariableRef  CVarChaosSolverInertiaConditioningMaxInvInertiaComponentRatio(TEXT("p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio"), ChaosSolverMaxInvInertiaComponentRatio, TEXT("An input to inertia conditioning system. The largest inertia component must be at least least multiple of the smallest component"));

		// Collision modifiers are run after the CCD rewind and manifold regeneration because the CCD "contact" data is only used to rewind the particle 
		// and we regenerate the manifold at that new position. Running the modifier callback before CCD rewind would mean that the user does not have 
		// data related to the actual contacts that will be resolved, and the positions and normals may be misleading. 
		// This cvar allows use to run the modifiers before CCD rewind which is how it used to be, just in case.
		// The new way to disable CCD contacts (pre-rewind) is to do it in a MidPhase- or CCD-Modifier callbacks. See FCCDModifier.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:1648

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsEvolutionGBF::UpdateInertiaConditioning

Source code excerpt:


	// A limit on the relative sizes of the inertia components (inverse)
	const FRealSingle MaxInvInertiaComponentRatio = ChaosSolverMaxInvInertiaComponentRatio;

	// @todo(chaos): we should only visit particles that are dirty
	for (auto& Rigid : Particles.GetNonDisabledDynamicView())
	{
		if (Rigid.InertiaConditioningDirty())
		{