p.AngularEtherDragOverride
p.AngularEtherDragOverride
#Overview
name: p.AngularEtherDragOverride
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set an override angular 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.AngularEtherDragOverride is to provide an override value for angular ether drag in Unreal Engine’s Chaos physics system. This setting variable is part of the physics simulation, specifically related to the drag forces applied to rotating objects in the simulated environment.
This setting variable is primarily used in the Chaos physics module, which is an experimental physics engine in Unreal Engine 5. It’s utilized in the rigid body evolution and per-particle ether drag calculations.
The value of this variable is set through a console variable (CVar) named “p.AngularEtherDragOverride”. It’s initialized with a default value of -1.f, which indicates that the override is disabled.
The associated variable AngularEtherDragOverride interacts directly with p.AngularEtherDragOverride. They share the same value, and AngularEtherDragOverride is used in the actual physics calculations.
Developers must be aware that:
- When set to a value >= 0, it overrides the default angular ether drag calculation.
- The default value of -1.f disables the override, allowing the system to use the particle’s own AngularEtherDrag() value.
- This variable affects the rotational behavior of objects in the physics simulation.
Best practices when using this variable include:
- Use it for fine-tuning physics behavior, especially when dealing with rotational dynamics.
- Be cautious when overriding, as it may affect the realism of the physics simulation.
- Test thoroughly with different values to ensure desired behavior across various scenarios.
- Consider performance implications, as overriding might bypass some optimizations.
Regarding the associated variable AngularEtherDragOverride:
- It’s used directly in the physics calculations, particularly in the Integrate function of FPBDRigidsEvolutionGBF.
- When AngularEtherDragOverride is >= 0, it’s used instead of the particle’s own AngularEtherDrag() value.
- It’s multiplied by the time step (Dt) to calculate the angular drag effect.
- The resulting drag is used to compute an AngularMultiplier, which is then applied to the angular velocity (W).
Developers should be aware that changes to AngularEtherDragOverride will have a direct impact on the rotational behavior of objects in the physics simulation. It’s important to balance between desired behavior and physical realism when adjusting this value.
#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:10
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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 AngularEtherDragOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:792
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::Integrate
lambda-function
Source code excerpt:
V *= LinearMultiplier;
const FReal AngularDrag = AngularEtherDragOverride >= 0 ? AngularEtherDragOverride : Particle.AngularEtherDrag() * Dt;
const FReal AngularMultiplier = FMath::Max(FReal(0), FReal(1) - AngularDrag);
W *= AngularMultiplier;
FReal LinearSpeedSq = V.SizeSquared();
if (LinearSpeedSq > Particle.MaxLinearSpeedSq())
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PerParticleEtherDrag.cpp:9
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
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:8
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
{
extern FRealSingle LinearEtherDragOverride;
extern FRealSingle AngularEtherDragOverride;
class FPerParticleEtherDrag : public FPerParticleRule
{
public:
FPerParticleEtherDrag() {}
virtual ~FPerParticleEtherDrag() {}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PerParticleEtherDrag.h:22
Scope (from outer to inner):
file
namespace Chaos
class class FPerParticleEtherDrag : public FPerParticleRule
function inline void ApplyHelper
Source code excerpt:
V *= LinearMultiplier;
const FReal AngularDrag = AngularEtherDragOverride >= 0 ? AngularEtherDragOverride : AngularDamp * Dt;
const FReal AngularMultiplier = FMath::Max(FReal(0), FReal(1) - AngularDrag);
W *= AngularMultiplier;
const FReal LinearSpeedSq = V.SizeSquared();
const FReal AngularSpeedSq = W.SizeSquared();