p.Chaos.ImmPhys.InertiaConditioning.Distance

p.Chaos.ImmPhys.InertiaConditioning.Distance

#Overview

name: p.Chaos.ImmPhys.InertiaConditioning.Distance

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.ImmPhys.InertiaConditioning.Distance is to serve as an input to the inertia conditioning system within Unreal Engine 5’s physics simulation. Specifically, it represents the joint distance error that needs to be stable (i.e., generate a low rotation) in the physics simulation.

This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s physics subsystem. It is particularly relevant to the Immediate Physics module, as evidenced by its usage in the ImmediatePhysicsSimulation_Chaos.cpp file.

The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. Its default value is set to 10.

This variable interacts closely with other inertia conditioning variables, such as ChaosImmediate_InertiaConditioningRotationRatio and ChaosImmediate_MaxInvInertiaComponentRatio. Together, these variables form part of the inertia conditioning system in the Chaos physics engine.

Developers should be aware that this variable directly affects the stability of joint simulations in the physics engine. A higher value may lead to more stable joints but potentially less accurate simulations, while a lower value might increase accuracy but could introduce instability.

Best practices when using this variable include:

  1. Adjusting it in conjunction with other inertia conditioning variables for optimal results.
  2. Testing thoroughly after modifications to ensure desired physics behavior.
  3. Considering performance implications, as changes may affect simulation complexity.

Regarding the associated variable ChaosImmediate_InertiaConditioningDistance:

This variable is directly linked to p.Chaos.ImmPhys.InertiaConditioning.Distance and serves as the actual storage for the value. It is used in the UpdateInertiaConditioning function of the ImmediatePhysics_Chaos namespace.

The purpose of ChaosImmediate_InertiaConditioningDistance is to store and provide the maximum distance value for inertia conditioning calculations. It represents the error distance that the constraint correction must be stable for in the physics simulation.

This variable is used within the Chaos Immediate Physics module, specifically in the inertia conditioning calculations.

The value is set through the console variable system and can be modified at runtime.

Developers should be aware that changes to this variable will directly affect the behavior of the inertia conditioning system in the Chaos physics engine. It’s crucial to understand the implications of adjusting this value on the overall physics simulation.

Best practices include:

  1. Coordinating changes to this variable with adjustments to other related inertia conditioning parameters.
  2. Monitoring performance and stability when modifying this value.
  3. Documenting any custom values used in production to ensure consistency across builds or team members.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:144

Scope: file

Source code excerpt:


Chaos::FRealSingle ChaosImmediate_InertiaConditioningDistance = 10;
FAutoConsoleVariableRef  CVarChaosImmPhysParticleInertiaConditioningDistance(TEXT("p.Chaos.ImmPhys.InertiaConditioning.Distance"), ChaosImmediate_InertiaConditioningDistance, TEXT("An input to inertia conditioning system. The joint distance error which needs to be stable (generate a low rotation)."));

Chaos::FRealSingle ChaosImmediate_InertiaConditioningRotationRatio = 2;
FAutoConsoleVariableRef  CVarChaosImmPhysParticleInertiaConditioningRotationRatio(TEXT("p.Chaos.ImmPhys.InertiaConditioning.RotationRatio"), ChaosImmediate_InertiaConditioningRotationRatio, TEXT("An input to inertia conditioning system. The maximum ratio of joint correction from rotation versus translation"));

Chaos::FRealSingle ChaosImmediate_MaxInvInertiaComponentRatio = 0;
FAutoConsoleVariableRef  CVarChaosImmPhysInertiaConditioningMaxInvInertiaComponentRatio(TEXT("p.Chaos.ImmPhys.InertiaConditioning.MaxInvInertiaComponentRatio"), ChaosImmediate_MaxInvInertiaComponentRatio, TEXT("An input to inertia conditioning system. The largest inertia component must be at least least multiple of the smallest component"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:143

Scope: file

Source code excerpt:

FAutoConsoleVariableRef  CVarChaosImmPhysParticleNonLinearInertiaConditioningEnabled(TEXT("p.Chaos.ImmPhys.InertiaConditioning.NonlinearEnabled"), bChaosImmediate_NonLinearInertiaConditioningEnabled, TEXT("Enable/Disable constraint stabilization through inertia conditioning when using the non-linear joint solver"));

Chaos::FRealSingle ChaosImmediate_InertiaConditioningDistance = 10;
FAutoConsoleVariableRef  CVarChaosImmPhysParticleInertiaConditioningDistance(TEXT("p.Chaos.ImmPhys.InertiaConditioning.Distance"), ChaosImmediate_InertiaConditioningDistance, TEXT("An input to inertia conditioning system. The joint distance error which needs to be stable (generate a low rotation)."));

Chaos::FRealSingle ChaosImmediate_InertiaConditioningRotationRatio = 2;
FAutoConsoleVariableRef  CVarChaosImmPhysParticleInertiaConditioningRotationRatio(TEXT("p.Chaos.ImmPhys.InertiaConditioning.RotationRatio"), ChaosImmediate_InertiaConditioningRotationRatio, TEXT("An input to inertia conditioning system. The maximum ratio of joint correction from rotation versus translation"));

Chaos::FRealSingle ChaosImmediate_MaxInvInertiaComponentRatio = 0;
FAutoConsoleVariableRef  CVarChaosImmPhysInertiaConditioningMaxInvInertiaComponentRatio(TEXT("p.Chaos.ImmPhys.InertiaConditioning.MaxInvInertiaComponentRatio"), ChaosImmediate_MaxInvInertiaComponentRatio, TEXT("An input to inertia conditioning system. The largest inertia component must be at least least multiple of the smallest component"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:994

Scope (from outer to inner):

file
namespace    ImmediatePhysics_Chaos
function     void FSimulation::UpdateInertiaConditioning

Source code excerpt:

			// The error distance that the constraint correction must be stable for
			// @todo(chaos): should probably be tied to constraint teleport threshold?
			const FRealSingle MaxDistance = ChaosImmediate_InertiaConditioningDistance;

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

			// @todo(chaos): keep track of changes to the flags so we don't need to loop every tick (maybe check it in Integrate)
			for (FActorHandle* Actor : Implementation->ActorHandles)