p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled
p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled
#Overview
name: p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled
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.AveragePointEnabled is to control the behavior of the Position-Based Dynamics (PBD) collision solver in the Chaos physics engine, specifically related to velocity calculations during collision resolution.
This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s experimental physics system. It’s utilized within the PBDCollisionSolver module, which handles collision resolution using the Position-Based Dynamics approach.
The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as a boolean value, initialized to false by default.
This variable interacts closely with its associated variable bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled. They share the same value and are used interchangeably in the code.
Developers should be aware that enabling this variable (setting it to true) will activate a feature that solves for average contact velocity when there are multiple manifold points in a collision. This can lead to more stable bouncing behavior and can help counteract velocity added by the PBD solve, especially in cases with zero restitution.
Best practices when using this variable include:
- Only enable it when dealing with complex collisions involving multiple contact points.
- Monitor performance impact, as solving for average velocity might introduce additional computational cost.
- Test thoroughly with different collision scenarios to ensure desired behavior across various use cases.
Regarding the associated variable bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled:
- Its purpose is identical to p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled.
- It’s used internally within the Chaos physics engine code.
- Its value is set through the console variable system, mirroring p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled.
- It’s primarily used in the SolveVelocity function of the FPBDCollisionSolver class to determine whether to call SolveVelocityAverage.
- Developers should treat it as an internal variable and modify its behavior through the p.Chaos.PBDCollisionSolver.Velocity.AveragePointEnabled console variable instead.
#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:52
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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
{
void FPBDCollisionSolver::SolveVelocityAverage(const FSolverReal Dt)
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionSolver.cpp:46
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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
{
void FPBDCollisionSolver::SolveVelocityAverage(const FSolverReal Dt)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/PBDCollisionSolver.h:18
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
namespace CVars
{
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:1080
Scope (from outer to inner):
file
namespace Chaos
namespace Private
function void FPBDCollisionSolver::SolveVelocity
Source code excerpt:
// This means we don't need to run as many iterations to get stable bouncing
// It also helps with zero restitution to counter any velocioty added by the PBD solve
const bool bSolveAverageContact = (NumManifoldPoints() > 1) && CVars::bChaos_PBDCollisionSolver_Velocity_AveragePointEnabled;
if (bSolveAverageContact)
{
SolveVelocityAverage(Dt);
}
// NOTE: this dynamic friction implementation is iteration-count sensitive