p.Chaos.Suspension.MaxPushout

p.Chaos.Suspension.MaxPushout

#Overview

name: p.Chaos.Suspension.MaxPushout

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.Suspension.MaxPushout is to control the maximum pushout value for the suspension system in Unreal Engine’s Chaos physics simulation. This setting is specifically used in the vehicle suspension system to limit the maximum distance a suspension can be pushed out during collision resolution.

This setting variable is primarily used in the Chaos physics subsystem, specifically within the suspension constraints module. It’s part of the experimental Chaos physics engine in Unreal Engine 5.

The value of this variable is set to a default of 5.0 units (likely in centimeters or Unreal units) in the PBDSuspensionConstraints.cpp file. It’s exposed as a console variable, which means it can be adjusted at runtime through the console or configuration files.

This variable interacts with another variable called Chaos_Suspension_MaxPushoutVelocity. In the ApplyPositionConstraint function, the actual maximum pushout value used is calculated as the minimum between p.Chaos.Suspension.MaxPushout and the product of Chaos_Suspension_MaxPushoutVelocity and the time step (Dt).

Developers must be aware that this variable directly affects the behavior of vehicle suspensions in the Chaos physics simulation. Setting it too low might result in unrealistic suspension behavior, while setting it too high might lead to visual artifacts or unstable simulation.

Best practices when using this variable include:

  1. Adjust it based on the scale of your game world and vehicles.
  2. Test thoroughly with different vehicle types and terrain to ensure realistic suspension behavior.
  3. Consider the interaction with Chaos_Suspension_MaxPushoutVelocity when fine-tuning suspension behavior.

Regarding the associated variable Chaos_Suspension_MaxPushout:

The purpose of Chaos_Suspension_MaxPushout is to store the actual value of the maximum pushout for the suspension system. It’s the C++ variable that holds the value set by the console variable p.Chaos.Suspension.MaxPushout.

This variable is used directly in the Chaos physics subsystem, specifically in the suspension constraints module.

Its value is set to a default of 5.0 units and can be modified through the console variable system.

It interacts directly with p.Chaos.Suspension.MaxPushout, as they share the same value. It’s also used in conjunction with Chaos_Suspension_MaxPushoutVelocity to calculate the final maximum pushout value in the ApplyPositionConstraint function.

Developers should be aware that modifying Chaos_Suspension_MaxPushout directly in code will not persist across sessions or be adjustable via the console. Instead, they should use the p.Chaos.Suspension.MaxPushout console variable to make adjustments.

Best practices include using this variable for reading the current maximum pushout value in code, and relying on the console variable system for making adjustments to its value during development or gameplay.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDSuspensionConstraints.cpp:18

Scope: file

Source code excerpt:


float Chaos_Suspension_MaxPushout = 5.f;
FAutoConsoleVariableRef CVarChaosSuspensionMaxPushout(TEXT("p.Chaos.Suspension.MaxPushout"), Chaos_Suspension_MaxPushout, TEXT("Chaos Suspension Max Pushout Value"));

float Chaos_Suspension_SlopeThreshold = 0.707f;	// = Cos(SlopeAngle)
FAutoConsoleVariableRef CVarChaosSuspensionSlopeThreshold(TEXT("p.Chaos.Suspension.SlopeThreshold"), Chaos_Suspension_SlopeThreshold, TEXT("Slope threshold below which the anti-slide on slope mechanism is employed, value = Cos(AlopeAngle), i.e. for 50 degree slope = 0.6428, 30 degree slope = 0.866"));

float Chaos_Suspension_SlopeSpeedThreshold = 1.0f; // MPH
FAutoConsoleVariableRef CVarChaosSuspensionSlopeSpeedThreshold(TEXT("p.Chaos.Suspension.SlopeSpeedThreshold"), Chaos_Suspension_SlopeSpeedThreshold, TEXT("Speed below which the anti-slide on slope mechanism is fully employed"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDSuspensionConstraints.cpp:17

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosSuspensionMaxPushoutVelocity(TEXT("p.Chaos.Suspension.MaxPushoutVelocity"), Chaos_Suspension_MaxPushoutVelocity, TEXT("Chaos Suspension Max Pushout Velocity Value"));

float Chaos_Suspension_MaxPushout = 5.f;
FAutoConsoleVariableRef CVarChaosSuspensionMaxPushout(TEXT("p.Chaos.Suspension.MaxPushout"), Chaos_Suspension_MaxPushout, TEXT("Chaos Suspension Max Pushout Value"));

float Chaos_Suspension_SlopeThreshold = 0.707f;	// = Cos(SlopeAngle)
FAutoConsoleVariableRef CVarChaosSuspensionSlopeThreshold(TEXT("p.Chaos.Suspension.SlopeThreshold"), Chaos_Suspension_SlopeThreshold, TEXT("Slope threshold below which the anti-slide on slope mechanism is employed, value = Cos(AlopeAngle), i.e. for 50 degree slope = 0.6428, 30 degree slope = 0.866"));

float Chaos_Suspension_SlopeSpeedThreshold = 1.0f; // MPH
FAutoConsoleVariableRef CVarChaosSuspensionSlopeSpeedThreshold(TEXT("p.Chaos.Suspension.SlopeSpeedThreshold"), Chaos_Suspension_SlopeSpeedThreshold, TEXT("Speed below which the anti-slide on slope mechanism is fully employed"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDSuspensionConstraints.cpp:322

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDSuspensionConstraints::ApplyPositionConstraint

Source code excerpt:

				if ((CollisionSolver != nullptr) && (CollisionSolver->NumManifoldPoints() > 0))
				{
					FReal MaxPushoutValue = FMath::Min(Chaos_Suspension_MaxPushout, Chaos_Suspension_MaxPushoutVelocity * Dt);
					CollisionSolver->SolvePositionNoFriction(FSolverReal(Dt), FSolverReal(MaxPushoutValue));
				}
			}
		}

		if (bChaos_Suspension_Spring_Enabled)