p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled
p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled
#Overview
name: p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled is to control whether friction is enabled in the velocity-based collision solving process within Unreal Engine’s Chaos physics system. This setting is specifically used in the Position-Based Dynamics (PBD) collision solver, which is part of the Chaos physics engine.
This setting variable is primarily used by the Chaos physics subsystem, which is an experimental physics engine in Unreal Engine 5. It’s particularly relevant to the collision solving module within Chaos.
The value of this variable is set through an FAutoConsoleVariableRef, which means it can be changed at runtime through the console or configuration files. It’s associated with the C++ boolean variable bChaos_PBDCollisionSolver_Velocity_FrictionEnabled, which is initialized to true by default.
This variable interacts closely with other collision solver settings, such as:
- p.Chaos.PBDCollisionSolver.Velocity.SolveEnabled
- p.Chaos.PBDCollisionSolver.Velocity.MinInvMassScale
- p.Chaos.PBDCollisionSolver.Velocity.StaticFriction.Stiffness
- p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled
Developers must be aware that:
- This setting directly affects the physics simulation’s behavior, particularly in how objects interact when colliding.
- Disabling friction might lead to unrealistic sliding behaviors but could potentially improve performance.
- Changes to this variable will affect all velocity-based collision solving in the Chaos system.
Best practices when using this variable include:
- Test thoroughly after making changes, as it can significantly impact gameplay and visual fidelity.
- Consider performance implications when enabling or disabling friction.
- Use in conjunction with other friction-related settings for fine-tuned control.
- Document any custom settings used in production to ensure consistency across the development team.
Regarding the associated variable bChaos_PBDCollisionSolver_Velocity_FrictionEnabled: This is the actual C++ boolean variable that stores the state of friction enablement. It’s used directly in the collision solving code to determine whether to apply friction calculations. The console variable p.Chaos.PBDCollisionSolver.Velocity.FrictionEnabled is linked to this C++ variable, allowing for runtime configuration. When working with the Chaos physics system programmatically, developers would interact with this boolean variable rather than the console command directly.
#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:50
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_PBDCollisionSolver_Velocity_FrictionEnabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionSolver.cpp:44
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// If Chaos_PBDCollisionSolver_Velocity_MinInvMassScale is the same as Chaos_PBDCollisionSolver_Position_MinInvMassScale and all velocity iterations have shockpropagation, we avoid recalculating constraint-space mass
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/Private/Chaos/Collision/PBDCollisionSolverSimd.cpp:18
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
namespace CVars
{
extern bool bChaos_PBDCollisionSolver_Velocity_FrictionEnabled;
extern float Chaos_PBDCollisionSolver_Position_StaticFrictionStiffness;
}
namespace Private
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionSolverSimd.cpp:169
Scope (from outer to inner):
file
namespace Chaos
namespace Private
function void FPBDCollisionSolverHelperSimd::SolveVelocityWithFriction<4>
Source code excerpt:
const FSolverReal InDt)
{
if (!CVars::bChaos_PBDCollisionSolver_Velocity_FrictionEnabled)
{
SolveVelocityNoFriction(Solvers, ManifoldPoints, Bodies, InDt);
return;
}
for (int32 Index = 0; Index < PrefetchCount; ++Index)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/PBDCollisionSolver.h:19
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
{
extern bool bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled;
extern bool bChaos_PBDCollisionSolver_Velocity_FrictionEnabled;
extern float Chaos_PBDCollisionSolver_Position_StaticFrictionStiffness;
extern float Chaos_PBDCollisionSolver_Velocity_StaticFrictionStiffness;
}
namespace Private
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/PBDCollisionSolver.h:1088
Scope (from outer to inner):
file
namespace Chaos
namespace Private
function void FPBDCollisionSolver::SolveVelocity
Source code excerpt:
// NOTE: this dynamic friction implementation is iteration-count sensitive
// @todo(chaos): fix iteration count dependence of dynamic friction
const FSolverReal DynamicFriction = (bApplyDynamicFriction && (Dt > 0) && CVars::bChaos_PBDCollisionSolver_Velocity_FrictionEnabled) ? State.VelocityFriction : FSolverReal(0);
for (int32 PointIndex = 0; PointIndex < NumManifoldPoints(); ++PointIndex)
{
FPBDCollisionSolverManifoldPoint& SolverManifoldPoint = State.ManifoldPoints[PointIndex];
const bool bShouldSolveNormalVelocity = (SolverManifoldPoint.NetPushOutNormal > FSolverReal(0));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/PBDCollisionSolverJacobi.h:19
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
namespace CVars
{
extern bool bChaos_PBDCollisionSolver_Velocity_FrictionEnabled;
extern float Chaos_PBDCollisionSolver_Position_StaticFrictionStiffness;
extern float Chaos_PBDCollisionSolver_JacobiStiffness;
extern float Chaos_PBDCollisionSolver_JacobiPositionTolerance;
extern float Chaos_PBDCollisionSolver_JacobiRotationTolerance;
}