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).
- type:
Var
- help:
An input to inertia conditioning system. The largest inertia component must be at least least multiple of the smallest component
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:
- This variable affects the rotational behavior of rigid bodies in physics simulations.
- A value greater than 1 will limit the inverse inertia components, making objects behave more like spheres (more “round” in terms of rotation).
- Setting it to 0 disables this inertia conditioning feature.
Best practices when using this variable include:
- Use it cautiously, as it can significantly affect the realism of physics simulations.
- Test different values to find the right balance between performance and desired physical behavior.
- 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:
- It’s a local variable that directly reflects the value of the console variable.
- It’s used in the UpdateInertiaConditioning() function to apply the inertia conditioning to rigid bodies.
- When modifying this variable, the changes will be immediately reflected in the physics simulations.
- Developers should primarily interact with the console variable (p.Chaos.Solver.InertiaConditioning.MaxInvInertiaComponentRatio) rather than this associated variable directly, as the console variable provides a standardized way to modify the behavior across the engine.
#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())
{