p.Chaos.Suspension.VelocitySolve

p.Chaos.Suspension.VelocitySolve

#Overview

name: p.Chaos.Suspension.VelocitySolve

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.VelocitySolve is to enable or disable the velocity solve component in the Chaos suspension system. This setting is part of the physics simulation, specifically for vehicle suspension in the Chaos physics engine of Unreal Engine 5.

This setting variable is primarily used in the Chaos module, which is an experimental physics engine in Unreal Engine 5. It is particularly relevant to the suspension system simulation, which is likely part of the vehicle physics simulation.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands. It is initialized to true by default.

The associated boolean variable bChaos_Suspension_VelocitySolve directly interacts with this console variable. They share the same value, and bChaos_Suspension_VelocitySolve is used in the actual code logic.

Developers must be aware that this variable controls a specific part of the suspension simulation. Disabling it might affect the realism or behavior of vehicle physics in the game. It’s used in conjunction with other suspension-related variables like p.Chaos.Suspension.Hardstop.Enabled, p.Chaos.Suspension.MaxPushoutVelocity, and p.Chaos.Suspension.MaxPushout.

Best practices when using this variable include:

  1. Testing the physics behavior with both enabled and disabled states to understand its impact.
  2. Considering performance implications, as enabling more complex physics calculations might affect performance.
  3. Using it in conjunction with other suspension-related settings for fine-tuning vehicle physics.

Regarding the associated variable bChaos_Suspension_VelocitySolve:

The purpose of bChaos_Suspension_VelocitySolve is to serve as the actual boolean flag used in the code logic to determine whether the velocity solve should be applied in the suspension simulation.

This variable is used directly in the Chaos physics engine, specifically in the FPBDSuspensionConstraints::ApplyVelocityConstraint function.

Its value is set by the console variable p.Chaos.Suspension.VelocitySolve, allowing for runtime modification.

It interacts closely with bChaos_Suspension_Hardstop_Enabled, as they are often checked together in conditional statements.

Developers should be aware that this variable directly affects the behavior of the ApplyVelocityConstraint function in the suspension system.

Best practices include ensuring consistency between this variable and its associated console variable, and considering its impact on both physics accuracy and performance when modifying 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:12

Scope: file

Source code excerpt:


bool bChaos_Suspension_VelocitySolve = true;
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"));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosSuspensionHardstopEnabled(TEXT("p.Chaos.Suspension.Hardstop.Enabled"), bChaos_Suspension_Hardstop_Enabled, TEXT("Enable/Disable Hardstop part of suspension constraint"));

bool bChaos_Suspension_VelocitySolve = true;
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"));

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDSuspensionConstraints::ApplyVelocityConstraint

Source code excerpt:

		using namespace Private;

		if (bChaos_Suspension_Hardstop_Enabled && bChaos_Suspension_VelocitySolve)
		{
			// Suspension Hardstop
			const FPBDSuspensionSettings& Setting = ConstraintSettings[ConstraintIndex];
			if (Setting.Enabled)
			{
				FPBDCollisionSolver* CollisionSolver = &CollisionSolvers[ConstraintIndex];