p.Chaos.Suspension.Hardstop.Enabled
p.Chaos.Suspension.Hardstop.Enabled
#Overview
name: p.Chaos.Suspension.Hardstop.Enabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable/Disable Hardstop part of suspension constraint
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Suspension.Hardstop.Enabled is to control the activation of the hardstop component in the suspension constraint system within Unreal Engine’s Chaos physics module.
This setting variable is primarily used in the Chaos physics module, which is part of Unreal Engine’s experimental physics system. Specifically, it’s used in the suspension constraint system, which is likely part of a vehicle physics simulation.
The value of this variable is set as a console variable, allowing it to be adjusted at runtime. It’s initialized to true by default:
bool bChaos_Suspension_Hardstop_Enabled = true;
FAutoConsoleVariableRef CVarChaosSuspensionHardstopEnabled(TEXT("p.Chaos.Suspension.Hardstop.Enabled"), bChaos_Suspension_Hardstop_Enabled, TEXT("Enable/Disable Hardstop part of suspension constraint"));
This variable interacts closely with bChaos_Suspension_VelocitySolve in the ApplyVelocityConstraint function. Both need to be true for the hardstop velocity solve to be applied.
Developers should be aware that this variable affects the behavior of the suspension system in vehicle physics simulations. Enabling or disabling it will change how the suspension responds, particularly at the limits of its travel (the “hardstop”).
Best practices when using this variable include:
- Testing vehicle physics with both enabled and disabled states to ensure desired behavior in all scenarios.
- Considering performance implications, as enabling this feature may increase computational cost.
- Using in conjunction with other suspension-related variables for fine-tuning vehicle physics.
Regarding the associated variable bChaos_Suspension_Hardstop_Enabled:
This is the actual boolean variable that stores the state controlled by the console variable. It’s used directly in the code to determine whether to apply the hardstop constraints in both the ApplyPositionConstraint and ApplyVelocityConstraint functions.
The purpose of this variable is the same as the console variable - to enable or disable the hardstop component of the suspension constraint. It’s set by the console variable and then used in the actual physics calculations.
Developers should be aware that changing the console variable will affect this boolean, which in turn directly impacts the physics calculations. When debugging or adjusting vehicle physics, monitoring this variable can provide insight into the current state of the hardstop system.
#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:9
Scope: file
Source code excerpt:
bool bChaos_Suspension_Hardstop_Enabled = true;
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"));
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_Suspension_Hardstop_Enabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDSuspensionConstraints.cpp:8
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSuspensionSpringEnabled(TEXT("p.Chaos.Suspension.Spring.Enabled"), bChaos_Suspension_Spring_Enabled, TEXT("Enable/Disable Spring part of suspension constraint"));
bool bChaos_Suspension_Hardstop_Enabled = true;
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"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDSuspensionConstraints.cpp:313
Scope (from outer to inner):
file
namespace Chaos
function void FPBDSuspensionConstraints::ApplyPositionConstraint
Source code excerpt:
using namespace Private;
if (bChaos_Suspension_Hardstop_Enabled)
{
// Suspension Hardstop
const FPBDSuspensionSettings& Setting = ConstraintSettings[ConstraintIndex];
if (Setting.Enabled)
{
FPBDCollisionSolver* CollisionSolver = &CollisionSolvers[ConstraintIndex];
#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];