p.Chaos.Suspension.MaxPushoutVelocity

p.Chaos.Suspension.MaxPushoutVelocity

#Overview

name: p.Chaos.Suspension.MaxPushoutVelocity

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.MaxPushoutVelocity is to control the maximum velocity at which suspension pushout can occur in the Chaos physics engine of Unreal Engine 5. This setting is specifically related to the vehicle suspension system within the Chaos physics simulation.

The Chaos physics engine, which is part of Unreal Engine’s experimental features, relies on this setting variable. Specifically, it is used in the PBDSuspensionConstraints module, which handles the position-based dynamics of vehicle suspensions.

The value of this variable is set to 100.0f by default, as seen in the source code. It is defined as a console variable, which means it can be adjusted at runtime through the console or configuration files.

This variable interacts closely with another variable named Chaos_Suspension_MaxPushout. Together, they determine the maximum pushout value in the ApplyPositionConstraint function. The actual maximum pushout used is the minimum of Chaos_Suspension_MaxPushout and Chaos_Suspension_MaxPushoutVelocity multiplied by the time step (Dt).

Developers must be aware that this variable directly affects the behavior of vehicle suspensions in the Chaos physics simulation. A higher value will allow for more rapid suspension movement, while a lower value will restrict it. This can significantly impact the feel and performance of vehicles in the game.

Best practices when using this variable include:

  1. Carefully tuning it in conjunction with Chaos_Suspension_MaxPushout to achieve the desired suspension behavior.
  2. Testing the variable’s effects across different types of vehicles and terrain.
  3. Considering performance implications, as very high values might lead to more complex physics calculations.

Regarding the associated variable Chaos_Suspension_MaxPushoutVelocity:

The purpose of Chaos_Suspension_MaxPushoutVelocity is identical to p.Chaos.Suspension.MaxPushoutVelocity. It’s the actual float variable that stores the value, while p.Chaos.Suspension.MaxPushoutVelocity is the console variable that allows for runtime modification.

This variable is used directly in the Chaos physics engine’s suspension calculations. It’s defined in the same file as the console variable and is used in the ApplyPositionConstraint function of the FPBDSuspensionConstraints class.

The value is set initially to 100.0f but can be modified through the console variable at runtime.

As mentioned earlier, it interacts closely with Chaos_Suspension_MaxPushout in determining the final maximum pushout value used in suspension calculations.

Developers should be aware that modifying this variable directly in the code will only change the initial value. For runtime adjustments, they should use the console variable p.Chaos.Suspension.MaxPushoutVelocity.

Best practices for this variable are the same as for the console variable, focusing on careful tuning, comprehensive testing, and performance consideration.

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

Scope: file

Source code excerpt:


float Chaos_Suspension_MaxPushoutVelocity = 100.f;
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"));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosSuspensionVelocitySolve(TEXT("p.Chaos.Suspension.VelocitySolve"), bChaos_Suspension_VelocitySolve, TEXT("Enable/Disable VelocitySolve"));

float Chaos_Suspension_MaxPushoutVelocity = 100.f;
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"));

#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)