p.Chaos.Suspension.SlopeSpeedBlendThreshold

p.Chaos.Suspension.SlopeSpeedBlendThreshold

#Overview

name: p.Chaos.Suspension.SlopeSpeedBlendThreshold

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.SlopeSpeedBlendThreshold is to control the speed at which the anti-slide on slope blend mechanism starts in the Chaos physics system, specifically for vehicle suspension simulation.

This setting variable is primarily used in the Chaos physics subsystem of Unreal Engine 5, particularly in the suspension constraints module. It’s part of the experimental Chaos physics engine, which is designed to provide more realistic and performant physics simulations.

The value of this variable is set in the C++ code as a default of 10.0f MPH (miles per hour). However, it’s exposed as a console variable, which means it can be modified at runtime through the console or configuration files.

This variable interacts closely with another variable named Chaos_Suspension_SlopeSpeedThreshold. Together, these variables control how vehicles behave on slopes at different speeds. While Chaos_Suspension_SlopeSpeedThreshold determines the speed below which the anti-slide mechanism is fully employed, p.Chaos.Suspension.SlopeSpeedBlendThreshold determines the speed at which the blending of this mechanism begins.

Developers must be aware that this variable is measured in miles per hour (MPH) in the code, but it’s converted to centimeters per second (cm/s) when used in calculations. This conversion is done using the factor 100000.f / 2236.94185f.

Best practices when using this variable include:

  1. Carefully tuning it in conjunction with Chaos_Suspension_SlopeSpeedThreshold to achieve the desired vehicle behavior on slopes.
  2. Testing the variable’s effects across a range of vehicle types and slope angles to ensure consistent and realistic behavior.
  3. Being mindful of the units (MPH) when adjusting the value.

Regarding the associated variable Chaos_Suspension_SlopeSpeedThreshold:

The purpose of Chaos_Suspension_SlopeSpeedThreshold is to define the speed below which the anti-slide on slope mechanism is fully employed in the Chaos physics system’s vehicle suspension simulation.

This variable is also part of the Chaos physics subsystem and works in tandem with p.Chaos.Suspension.SlopeSpeedBlendThreshold to control vehicle behavior on slopes.

The value of Chaos_Suspension_SlopeSpeedThreshold is not shown in the provided code snippet, but it’s also exposed as a console variable for runtime modification.

This variable interacts directly with p.Chaos.Suspension.SlopeSpeedBlendThreshold in determining how the anti-slide mechanism is applied at different vehicle speeds.

Developers should be aware that this variable is also measured in MPH and converted to cm/s in the code. It’s used in conjunction with another variable, Chaos_Suspension_SlopeThreshold, which likely defines the slope angle at which the anti-slide mechanism becomes active.

Best practices for using Chaos_Suspension_SlopeSpeedThreshold include:

  1. Tuning it in relation to p.Chaos.Suspension.SlopeSpeedBlendThreshold to create a smooth transition in vehicle behavior as speed changes on slopes.
  2. Testing its effects on various vehicle types and slope conditions to ensure desired performance.
  3. Considering its impact on gameplay and vehicle control when adjusting its value.

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

Scope: file

Source code excerpt:


float Chaos_Suspension_SlopeSpeedBlendThreshold = 10.0f; // MPH
FAutoConsoleVariableRef CVarChaosSuspensionSlopeSpeedBlendThreshold(TEXT("p.Chaos.Suspension.SlopeSpeedBlendThreshold"), Chaos_Suspension_SlopeSpeedBlendThreshold, TEXT("Speed below which the anti-slide on slope blend mechanism starts"));

#if CHAOS_DEBUG_DRAW
bool bChaos_Suspension_DebugDraw_Hardstop = false;
FAutoConsoleVariableRef CVarChaosSuspensionDebugDrawHardstop(TEXT("p.Chaos.Suspension.DebugDraw.Hardstop"), bChaos_Suspension_DebugDraw_Hardstop, TEXT("Debug draw suspension hardstop manifold"));
#endif

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

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

float Chaos_Suspension_SlopeSpeedBlendThreshold = 10.0f; // MPH
FAutoConsoleVariableRef CVarChaosSuspensionSlopeSpeedBlendThreshold(TEXT("p.Chaos.Suspension.SlopeSpeedBlendThreshold"), Chaos_Suspension_SlopeSpeedBlendThreshold, TEXT("Speed below which the anti-slide on slope blend mechanism starts"));

#if CHAOS_DEBUG_DRAW
bool bChaos_Suspension_DebugDraw_Hardstop = false;
FAutoConsoleVariableRef CVarChaosSuspensionDebugDrawHardstop(TEXT("p.Chaos.Suspension.DebugDraw.Hardstop"), bChaos_Suspension_DebugDraw_Hardstop, TEXT("Debug draw suspension hardstop manifold"));
#endif

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDSuspensionConstraints::ApplySingle

Source code excerpt:

			const float MPHToCmS = 100000.f / 2236.94185f;
			const float SpeedThreshold = Chaos_Suspension_SlopeSpeedThreshold * MPHToCmS;
			const float SpeedBlendThreshold = Chaos_Suspension_SlopeSpeedBlendThreshold * MPHToCmS;

			// Ingeniously blends the surface normal at low speeds to stop vehicles sliding slowly down steep slopes
			if (SurfaceNormal.Z > Chaos_Suspension_SlopeThreshold)
			{
				if (Body.V().SquaredLength() < (SpeedThreshold * SpeedThreshold))
				{