p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD
p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD
#Overview
name: p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override max velocity bounds expansion for MACD (if >= 0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD is to override the maximum velocity bounds expansion for Movement-Aware Collision Detection (MACD) in the Chaos physics solver of Unreal Engine 5.
This setting variable is primarily used by the Chaos physics system, which is part of Unreal Engine’s experimental features. It specifically relates to the collision detection subsystem within the Chaos solver.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1000.0f and can be modified at runtime using the console command system.
This variable interacts closely with ChaosSolverMaxVelocityBoundsExpansionMACD, which is the associated C++ variable that holds the actual value. It also works in conjunction with ChaosSolverVelocityBoundsMultiplierMACD, another setting that affects the velocity bounds for MACD.
Developers should be aware that this variable only takes effect when its value is greater than or equal to 0. If set to a negative value, it will not override the default behavior.
Best practices when using this variable include:
- Only modify it if you understand the implications on collision detection performance and accuracy.
- Use it in conjunction with ChaosSolverVelocityBoundsMultiplierMACD for fine-tuning MACD behavior.
- Monitor performance and collision accuracy when adjusting this value, as it can significantly impact both.
Regarding the associated variable ChaosSolverMaxVelocityBoundsExpansionMACD:
This C++ variable directly holds the value set by the p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD console variable. It’s used within the Chaos solver to determine the maximum expansion of velocity bounds for MACD.
The value of ChaosSolverMaxVelocityBoundsExpansionMACD is applied in the FPBDRigidsSolver::PrepareAdvanceBy function, where it’s passed to the SetVelocityBoundsExpansionMACD method if both it and ChaosSolverVelocityBoundsMultiplierMACD are non-negative.
When working with this variable, developers should:
- Understand that it directly affects the collision detection system’s behavior.
- Be cautious when modifying it, as extreme values could lead to performance issues or inaccurate collision detection.
- Consider its interaction with ChaosSolverVelocityBoundsMultiplierMACD for a complete understanding of how velocity bounds are calculated for MACD.
#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:350
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverMaxVelocityBoundsExpansion(TEXT("p.Chaos.Solver.Collision.MaxVelocityBoundsExpansion"), ChaosSolverMaxVelocityBoundsExpansion, TEXT("Override max velocity bounds expansion (if >= 0)"), OnCollisionConfigCVarChanged);
FAutoConsoleVariableRef CVarChaosSolverVelocityBoundsMultiplierMACD(TEXT("p.Chaos.Solver.Collision.VelocityBoundsMultiplierMACD"), ChaosSolverVelocityBoundsMultiplierMACD, TEXT("Override velocity bounds multiplier for MACD (if >= 0)"), OnCollisionConfigCVarChanged);
FAutoConsoleVariableRef CVarChaosSolverMaxVelocityBoundsExpansionMACD(TEXT("p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD"), ChaosSolverMaxVelocityBoundsExpansionMACD, TEXT("Override max velocity bounds expansion for MACD (if >= 0)"), OnCollisionConfigCVarChanged);
FRealSingle ChaosSolverMaxPushOutVelocity = -1.0f;
FAutoConsoleVariableRef CVarChaosSolverMaxPushOutVelocity(TEXT("p.Chaos.Solver.Collision.MaxPushOutVelocity"), ChaosSolverMaxPushOutVelocity, TEXT("Override max pushout velocity (if >= 0)"), OnCollisionConfigCVarChanged);
FRealSingle ChaosSolverDepenetrationVelocity = -1.0f;
FAutoConsoleVariableRef CVarChaosSolverInitialOverlapDepentrationVelocity(TEXT("p.Chaos.Solver.Collision.DepenetrationVelocity"), ChaosSolverDepenetrationVelocity, TEXT("Override initial overlap depenetration velocity (if >= 0)"), OnCollisionConfigCVarChanged);
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverMaxVelocityBoundsExpansionMACD
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:346
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FRealSingle ChaosSolverMaxVelocityBoundsExpansion = 3.0f; // This should probably be a fraction of object size (see FParticlePairMidPhase::GenerateCollisions)
FRealSingle ChaosSolverVelocityBoundsMultiplierMACD = 1.0f;
FRealSingle ChaosSolverMaxVelocityBoundsExpansionMACD = 1000.0f; // For use when Movement-Aware Collision Detection (MACD) is enabled
FAutoConsoleVariableRef CVarChaosSolverVelocityBoundsMultiplier(TEXT("p.Chaos.Solver.Collision.VelocityBoundsMultiplier"), ChaosSolverVelocityBoundsMultiplier, TEXT("Override velocity bounds multiplier (if >= 0)"), OnCollisionConfigCVarChanged);
FAutoConsoleVariableRef CVarChaosSolverMaxVelocityBoundsExpansion(TEXT("p.Chaos.Solver.Collision.MaxVelocityBoundsExpansion"), ChaosSolverMaxVelocityBoundsExpansion, TEXT("Override max velocity bounds expansion (if >= 0)"), OnCollisionConfigCVarChanged);
FAutoConsoleVariableRef CVarChaosSolverVelocityBoundsMultiplierMACD(TEXT("p.Chaos.Solver.Collision.VelocityBoundsMultiplierMACD"), ChaosSolverVelocityBoundsMultiplierMACD, TEXT("Override velocity bounds multiplier for MACD (if >= 0)"), OnCollisionConfigCVarChanged);
FAutoConsoleVariableRef CVarChaosSolverMaxVelocityBoundsExpansionMACD(TEXT("p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD"), ChaosSolverMaxVelocityBoundsExpansionMACD, TEXT("Override max velocity bounds expansion for MACD (if >= 0)"), OnCollisionConfigCVarChanged);
FRealSingle ChaosSolverMaxPushOutVelocity = -1.0f;
FAutoConsoleVariableRef CVarChaosSolverMaxPushOutVelocity(TEXT("p.Chaos.Solver.Collision.MaxPushOutVelocity"), ChaosSolverMaxPushOutVelocity, TEXT("Override max pushout velocity (if >= 0)"), OnCollisionConfigCVarChanged);
FRealSingle ChaosSolverDepenetrationVelocity = -1.0f;
FAutoConsoleVariableRef CVarChaosSolverInitialOverlapDepentrationVelocity(TEXT("p.Chaos.Solver.Collision.DepenetrationVelocity"), ChaosSolverDepenetrationVelocity, TEXT("Override initial overlap depenetration velocity (if >= 0)"), OnCollisionConfigCVarChanged);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1348
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
SetVelocityBoundsExpansion(ChaosSolverVelocityBoundsMultiplier, ChaosSolverMaxVelocityBoundsExpansion);
}
if ((ChaosSolverVelocityBoundsMultiplierMACD >= 0.0f) && (ChaosSolverMaxVelocityBoundsExpansionMACD >= 0.0f))
{
SetVelocityBoundsExpansionMACD(ChaosSolverVelocityBoundsMultiplierMACD, ChaosSolverMaxVelocityBoundsExpansionMACD);
}
if (ChaosSolverMaxPushOutVelocity >= 0.0f)
{
SetCollisionMaxPushOutVelocity(ChaosSolverMaxPushOutVelocity);
}
if (ChaosSolverDepenetrationVelocity >= 0.0f)