p.Chaos.ImmPhys.InertiaConditioning.NonlinearEnabled

p.Chaos.ImmPhys.InertiaConditioning.NonlinearEnabled

#Overview

name: p.Chaos.ImmPhys.InertiaConditioning.NonlinearEnabled

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.NonlinearEnabled is to enable or disable constraint stabilization through inertia conditioning when using the non-linear joint solver in Unreal Engine’s Chaos physics system.

This setting variable is part of the Chaos physics system, specifically within the Immediate Physics module. It is used in the ImmediatePhysicsChaos subsystem, which is responsible for real-time physics simulations.

The value of this variable is set through the Unreal Engine console variable system (CVars). It is initialized as false by default, meaning the feature is disabled unless explicitly enabled.

This variable interacts closely with bChaosImmediate_NonLinearInertiaConditioningEnabled, which is the associated C++ boolean variable that directly controls the feature in the code. It also works in conjunction with other related variables such as p.Chaos.ImmPhys.InertiaConditioning.LinearEnabled, p.Chaos.ImmPhys.InertiaConditioning.Distance, and p.Chaos.ImmPhys.InertiaConditioning.RotationRatio.

Developers must be aware that this variable specifically affects the non-linear joint solver. There is a separate variable (p.Chaos.ImmPhys.InertiaConditioning.LinearEnabled) for the linear joint solver. The choice between linear and non-linear solvers can significantly impact physics simulation behavior and performance.

Best practices when using this variable include:

  1. Testing the physics simulation with both enabled and disabled states to determine the optimal setting for your specific use case.
  2. Considering the performance implications, as enabling this feature may increase computational cost.
  3. Using in conjunction with the other inertia conditioning variables to fine-tune the physics behavior.

Regarding the associated variable bChaosImmediate_NonLinearInertiaConditioningEnabled:

The purpose of this variable is to directly control the inertia conditioning feature in the C++ code of the Chaos physics system.

It is used within the ImmediatePhysicsChaos module, specifically in the FSimulation::UpdateInertiaConditioning function.

The value of this variable is set by the console variable system, mirroring the value of p.Chaos.ImmPhys.InertiaConditioning.NonlinearEnabled.

This variable interacts with bChaosImmediate_LinearInertiaConditioningEnabled to determine whether to use inertia conditioning based on the type of joint solver being used.

Developers should be aware that this variable directly affects the behavior of the UpdateInertiaConditioning function, which is crucial for physics simulation stability.

Best practices include ensuring that any changes to the console variable are properly reflected in this C++ variable, and vice versa, to maintain consistency in the physics simulation behavior.

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

Scope: file

Source code excerpt:


bool bChaosImmediate_NonLinearInertiaConditioningEnabled = false;
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"));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

FAutoConsoleVariableRef  CVarChaosImmPhysParticleLinearInertiaConditioningEnabled(TEXT("p.Chaos.ImmPhys.InertiaConditioning.LinearEnabled"), bChaosImmediate_LinearInertiaConditioningEnabled, TEXT("Enable/Disable constraint stabilization through inertia conditioning when using the linear joint solver"));

bool bChaosImmediate_NonLinearInertiaConditioningEnabled = false;
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"));

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

Scope (from outer to inner):

file
namespace    ImmediatePhysics_Chaos
function     void FSimulation::UpdateInertiaConditioning

Source code excerpt:


		// Linear and Non-linear joint solvers have a separate cvar to enable inertia conditioning
		const bool bUseInertiaConditioning = Implementation->Joints.GetSettings().bUseLinearSolver ? bChaosImmediate_LinearInertiaConditioningEnabled : bChaosImmediate_NonLinearInertiaConditioningEnabled;

		if (bUseInertiaConditioning)
		{
			// The maximum contribution to error correction from rotation
			const FRealSingle MaxRotationRatio = ChaosImmediate_InertiaConditioningRotationRatio;