p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness
p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness
#Overview
name: p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness is to control the stiffness of static friction in the Position-Based Dynamics (PBD) collision solver within Unreal Engine’s Chaos physics system. This setting variable is specifically used for velocity-based collision resolution.
This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics framework. It is utilized within the PBD collision solver module.
The value of this variable is set through the Unreal Engine’s console variable system. It is defined and initialized in the Chaos namespace, specifically in the CVars (Console Variables) sub-namespace. The initial value is set to 1.0f, but it can be modified at runtime through the console or programmatically.
This variable interacts closely with other collision solver parameters, particularly those related to friction calculations. It’s directly associated with the C++ variable Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness
, which shares the same value.
Developers must be aware that this variable specifically affects the velocity-based part of the collision solver. It’s used to scale the friction stiffness in velocity correction calculations. Changing this value will affect how “sticky” or “slippery” objects appear during collision resolution.
Best practices when using this variable include:
- Experiment with different values to find the right balance for your specific simulation needs.
- Be cautious when modifying this value, as it can significantly impact the behavior of physics objects in your game.
- Consider the interplay between this variable and other friction-related settings in the physics system.
- Use this in conjunction with other PBD solver settings for fine-tuning physics behavior.
Regarding the associated variable Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness:
This C++ variable directly corresponds to the console variable we’ve been discussing. It’s used within the physics solver code to apply the static friction stiffness during velocity correction calculations. The variable is defined in the Chaos::CVars namespace and is used in the collision solver’s velocity correction function.
The purpose of this variable is the same as the console variable - to control the stiffness of static friction in velocity-based collision resolution. It’s multiplied with the overall stiffness and the contact mass to calculate friction impulses.
Developers should be aware that modifying this variable directly in code will have the same effect as changing the console variable. It’s important to ensure that any changes to this variable are consistent with the desired physics behavior in your game or simulation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionSolver.cpp:51
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_MinInvMassScale(TEXT("p.Chaos.PBDCollisionSolver.Velocity.MinInvMassScale"), Chaos_PBDCollisionSolver_Velocity_MinInvMassScale, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_FrictionEnabled(TEXT("p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled"), bChaos_PBDCollisionSolver_Velocity_FrictionEnabled, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness(TEXT("p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness"), Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_AveragePointEnabled(TEXT("p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled"), bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled, TEXT(""));
}
using namespace CVars;
namespace Private
{
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionSolver.cpp:45
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
float Chaos_PBDCollisionSolver_Velocity_MinInvMassScale = Chaos_PBDCollisionSolver_Position_MinInvMassScale;
bool bChaos_PBDCollisionSolver_Velocity_FrictionEnabled = true;
float Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness = 1.0f;
bool bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled = false;
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_SolveEnabled(TEXT("p.Chaos.PBDCollisionSolver.Velocity.SolveEnabled"), bChaos_PBDCollisionSolver_Velocity_SolveEnabled, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_MinInvMassScale(TEXT("p.Chaos.PBDCollisionSolver.Velocity.MinInvMassScale"), Chaos_PBDCollisionSolver_Velocity_MinInvMassScale, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_FrictionEnabled(TEXT("p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled"), bChaos_PBDCollisionSolver_Velocity_FrictionEnabled, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness(TEXT("p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness"), Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness, TEXT(""));
FAutoConsoleVariableRef CVarChaos_PBDCollisionSolver_Velocity_AveragePointEnabled(TEXT("p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled"), bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled, TEXT(""));
}
using namespace CVars;
namespace Private
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/PBDCollisionSolver.h:21
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
extern bool bChaos_PBDCollisionSolver_Velocity_FrictionEnabled;
extern float Chaos_PBDCollisionSolver_Position_StaticFrictionStiffness;
extern float Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness;
}
namespace Private
{
/**
* @brief A single contact point in a FPBDCollisionSolver
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/PBDCollisionSolver.h:640
Scope (from outer to inner):
file
namespace Chaos
namespace Private
function void FPBDCollisionSolver::ApplyVelocityCorrection
Source code excerpt:
if ((DynamicFriction > 0) && (Dt > 0))
{
const FSolverReal FrictionStiffness = Stiffness * CVars::Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness;
ImpulseTangentU = -FrictionStiffness * ManifoldPoint.ContactMassTangentU * ContactVelocityDeltaTangent0;
ImpulseTangentV = -FrictionStiffness * ManifoldPoint.ContactMassTangentV * ContactVelocityDeltaTangent1;
const FSolverReal TotalImpulseNormal
= ManifoldPoint.NetImpulseNormal
+ ImpulseNormal