p.Chaos.Solver.Collision.VelocityFrictionIterations
p.Chaos.Solver.Collision.VelocityFrictionIterations
#Overview
name: p.Chaos.Solver.Collision.VelocityFrictionIterations
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override number of velocity iterations where friction is applied (if >= 0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Collision.VelocityFrictionIterations is to control the number of velocity iterations where friction is applied in the Chaos physics solver of Unreal Engine 5. This setting variable is part of the collision handling system within the Chaos physics engine.
This setting variable is primarily used in the Chaos physics subsystem, specifically within the PBDRigidsSolver module. Based on the callsites, it’s clear that this variable is part of the experimental Chaos namespace, indicating it’s part of the new physics engine in Unreal Engine 5.
The value of this variable is set through a console variable system, as evidenced by the FAutoConsoleVariableRef declaration. This allows developers to change the value at runtime or through configuration files.
The associated variable ChaosSolverCollisionVelocityFrictionIterations interacts directly with p.Chaos.Solver.Collision.VelocityFrictionIterations. They share the same value, with the console variable acting as an interface to set the internal variable.
Developers must be aware that:
- The variable only takes effect if its value is greater than or equal to 0. Negative values are ignored.
- This variable specifically affects velocity iterations, as opposed to position iterations which are controlled by a separate variable.
- Changing this value will directly impact the performance and accuracy of friction calculations in collision resolution.
Best practices when using this variable include:
- Start with the default value and only adjust if specific friction-related issues are observed.
- Monitor performance closely when increasing the number of iterations, as it may impact overall simulation speed.
- Use in conjunction with p.Chaos.Solver.Collision.PositionFrictionIterations for comprehensive friction control.
- Consider the trade-off between accuracy and performance when adjusting this value.
Regarding the associated variable ChaosSolverCollisionVelocityFrictionIterations:
- Its purpose is to store the actual value used by the solver for velocity friction iterations.
- It’s used within the Chaos physics solver, specifically in the PrepareAdvanceBy function of FPBDRigidsSolver.
- Its value is set by the console variable p.Chaos.Solver.Collision.VelocityFrictionIterations.
- It directly interacts with the MEvolution object, setting the velocity friction iterations for collision constraints.
- Developers should be aware that this variable is the actual implementation of the friction iteration count, while the console variable provides an interface to modify it.
- Best practice is to modify this variable through the console variable rather than directly, to ensure consistency across the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:305
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverCollisionVelocityShockPropagationIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverCollisionPositionFrictionIterations(TEXT("p.Chaos.Solver.Collision.PositionFrictionIterations"), ChaosSolverCollisionPositionFrictionIterations, TEXT("Override number of position iterations where friction is applied (if >= 0)"));
FAutoConsoleVariableRef CVarChaosSolverCollisionVelocityFrictionIterations(TEXT("p.Chaos.Solver.Collision.VelocityFrictionIterations"), ChaosSolverCollisionVelocityFrictionIterations, TEXT("Override number of velocity iterations where friction is applied (if >= 0)"));
FAutoConsoleVariableRef CVarChaosSolverCollisionPositionShockPropagationIterations(TEXT("p.Chaos.Solver.Collision.PositionShockPropagationIterations"), ChaosSolverCollisionPositionShockPropagationIterations, TEXT("Override number of position iterations where shock propagation is applied (if >= 0)"));
FAutoConsoleVariableRef CVarChaosSolverCollisionVelocityShockPropagationIterations(TEXT("p.Chaos.Solver.Collision.VelocityShockPropagationIterations"), ChaosSolverCollisionVelocityShockPropagationIterations, TEXT("Override number of velocity iterations where shock propagation is applied (if >= 0)"));
int32 ChaosSolverPositionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverIterations(TEXT("p.Chaos.Solver.Iterations.Position"), ChaosSolverPositionIterations, TEXT("Override number of solver position iterations (-1 to use config)"));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverCollisionVelocityFrictionIterations
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:301
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverCollisionPositionFrictionIterations = -1;
int32 ChaosSolverCollisionVelocityFrictionIterations = -1;
int32 ChaosSolverCollisionPositionShockPropagationIterations = -1;
int32 ChaosSolverCollisionVelocityShockPropagationIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverCollisionPositionFrictionIterations(TEXT("p.Chaos.Solver.Collision.PositionFrictionIterations"), ChaosSolverCollisionPositionFrictionIterations, TEXT("Override number of position iterations where friction is applied (if >= 0)"));
FAutoConsoleVariableRef CVarChaosSolverCollisionVelocityFrictionIterations(TEXT("p.Chaos.Solver.Collision.VelocityFrictionIterations"), ChaosSolverCollisionVelocityFrictionIterations, TEXT("Override number of velocity iterations where friction is applied (if >= 0)"));
FAutoConsoleVariableRef CVarChaosSolverCollisionPositionShockPropagationIterations(TEXT("p.Chaos.Solver.Collision.PositionShockPropagationIterations"), ChaosSolverCollisionPositionShockPropagationIterations, TEXT("Override number of position iterations where shock propagation is applied (if >= 0)"));
FAutoConsoleVariableRef CVarChaosSolverCollisionVelocityShockPropagationIterations(TEXT("p.Chaos.Solver.Collision.VelocityShockPropagationIterations"), ChaosSolverCollisionVelocityShockPropagationIterations, TEXT("Override number of velocity iterations where shock propagation is applied (if >= 0)"));
int32 ChaosSolverPositionIterations = -1;
FAutoConsoleVariableRef CVarChaosSolverIterations(TEXT("p.Chaos.Solver.Iterations.Position"), ChaosSolverPositionIterations, TEXT("Override number of solver position iterations (-1 to use config)"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1321
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
MEvolution->GetCollisionConstraints().SetPositionFrictionIterations(ChaosSolverCollisionPositionFrictionIterations);
}
if (ChaosSolverCollisionVelocityFrictionIterations >= 0)
{
MEvolution->GetCollisionConstraints().SetVelocityFrictionIterations(ChaosSolverCollisionVelocityFrictionIterations);
}
{
MEvolution->SetShockPropagationIterations(ChaosSolverCollisionPositionShockPropagationIterations, ChaosSolverCollisionVelocityShockPropagationIterations);
}
if (ChaosSolverPositionIterations >= 0)
{