p.LinearEtherDragOverride
p.LinearEtherDragOverride
#Overview
name: p.LinearEtherDragOverride
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set an override linear ether drag value. -1.f to disable
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.LinearEtherDragOverride is to provide an override value for linear ether drag in Unreal Engine’s Chaos physics system. This setting variable is used to control the damping effect on linear motion of particles or rigid bodies in the physics simulation.
This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics framework. It is referenced in the Chaos module of the engine.
The value of this variable is set through a console variable (CVar) named “p.LinearEtherDragOverride”. It is initialized with a default value of -1.f, which means the override is disabled by default.
The p.LinearEtherDragOverride interacts closely with another variable called LinearEtherDragOverride. They share the same value, and LinearEtherDragOverride is used in the actual physics calculations.
Developers must be aware that:
- Setting this variable to a value >= 0 will override the per-particle linear ether drag values.
- Keeping it at -1.f (default) will use the per-particle linear ether drag values.
Best practices when using this variable include:
- Use it for debugging or testing purposes to quickly adjust the overall linear drag in the physics simulation.
- Be cautious when setting non-default values in production, as it will affect all particles/rigid bodies uniformly.
- Remember to reset it to -1.f when you want to revert to using per-particle drag values.
Regarding the associated variable LinearEtherDragOverride:
The purpose of LinearEtherDragOverride is to store the actual override value for linear ether drag used in physics calculations.
It is used directly in the Chaos physics system, specifically in the FPBDRigidsEvolutionGBF::Integrate function and the FPerParticleEtherDrag::ApplyHelper function.
The value of LinearEtherDragOverride is set by the console variable p.LinearEtherDragOverride.
It interacts with the per-particle LinearEtherDrag() value. If LinearEtherDragOverride is >= 0, it takes precedence over the per-particle value.
Developers should be aware that this variable directly affects the physics simulation. When it’s >= 0, it applies a uniform linear drag to all particles/rigid bodies, potentially overriding individual object settings.
Best practices include:
- Use it in conjunction with p.LinearEtherDragOverride for consistent behavior.
- Be mindful of its performance impact, as it’s used in frequently called physics update functions.
- Consider using it for prototyping or specific effects, but rely on per-particle drag for more nuanced physics behavior in final implementations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PerParticleEtherDrag.cpp:7
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FRealSingle LinearEtherDragOverride = -1.f;
FAutoConsoleVariableRef CVarLinearEtherDragOverride(TEXT("p.LinearEtherDragOverride"), LinearEtherDragOverride, TEXT("Set an override linear ether drag value. -1.f to disable"));
FRealSingle AngularEtherDragOverride = -1.f;
FAutoConsoleVariableRef CVarAngularEtherDragOverride(TEXT("p.AngularEtherDragOverride"), AngularEtherDragOverride, TEXT("Set an override angular ether drag value. -1.f to disable"));
}
#Associated Variable and Callsites
This variable is associated with another variable named LinearEtherDragOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:788
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::Integrate
lambda-function
Source code excerpt:
//EtherDragRule.Apply(Particle, Dt);
const FReal LinearDrag = LinearEtherDragOverride >= 0 ? LinearEtherDragOverride : Particle.LinearEtherDrag() * Dt;
const FReal LinearMultiplier = FMath::Max(FReal(0), FReal(1) - LinearDrag);
V *= LinearMultiplier;
const FReal AngularDrag = AngularEtherDragOverride >= 0 ? AngularEtherDragOverride : Particle.AngularEtherDrag() * Dt;
const FReal AngularMultiplier = FMath::Max(FReal(0), FReal(1) - AngularDrag);
W *= AngularMultiplier;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PerParticleEtherDrag.cpp:6
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
{
FRealSingle LinearEtherDragOverride = -1.f;
FAutoConsoleVariableRef CVarLinearEtherDragOverride(TEXT("p.LinearEtherDragOverride"), LinearEtherDragOverride, TEXT("Set an override linear ether drag value. -1.f to disable"));
FRealSingle AngularEtherDragOverride = -1.f;
FAutoConsoleVariableRef CVarAngularEtherDragOverride(TEXT("p.AngularEtherDragOverride"), AngularEtherDragOverride, TEXT("Set an override angular ether drag value. -1.f to disable"));
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PerParticleEtherDrag.h:7
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
namespace Chaos
{
extern FRealSingle LinearEtherDragOverride;
extern FRealSingle AngularEtherDragOverride;
class FPerParticleEtherDrag : public FPerParticleRule
{
public:
FPerParticleEtherDrag() {}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PerParticleEtherDrag.h:18
Scope (from outer to inner):
file
namespace Chaos
class class FPerParticleEtherDrag : public FPerParticleRule
function inline void ApplyHelper
Source code excerpt:
inline void ApplyHelper(FVec3& V, FVec3& W, FReal LinearDamp, FReal AngularDamp, FReal LinearLimitSq, FReal AngularLimitSq, FReal Dt) const
{
const FReal LinearDrag = LinearEtherDragOverride >= 0 ? LinearEtherDragOverride : LinearDamp * Dt;
const FReal LinearMultiplier = FMath::Max(FReal(0), FReal(1) - LinearDrag);
V *= LinearMultiplier;
const FReal AngularDrag = AngularEtherDragOverride >= 0 ? AngularEtherDragOverride : AngularDamp * Dt;
const FReal AngularMultiplier = FMath::Max(FReal(0), FReal(1) - AngularDrag);
W *= AngularMultiplier;