p.Chaos.Solver.Collision.VelocityBoundsMultiplierMACD
p.Chaos.Solver.Collision.VelocityBoundsMultiplierMACD
#Overview
name: p.Chaos.Solver.Collision.VelocityBoundsMultiplierMACD
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override velocity bounds multiplier 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.VelocityBoundsMultiplierMACD is to override the velocity bounds multiplier for Movement-Aware Collision Detection (MACD) in the Chaos physics solver. This setting is specifically used for collision detection in the Chaos physics system, which is part of Unreal Engine’s physics simulation capabilities.
The Unreal Engine subsystem that relies on this setting variable is the Chaos physics solver, which is part of the Experimental Chaos module. This can be seen from the namespace and file location in the provided code snippets.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an FAutoConsoleVariableRef, which allows it to be changed at runtime through console commands or configuration files.
This variable interacts closely with ChaosSolverVelocityBoundsMultiplierMACD, which is its associated C++ variable. They share the same value, with the console variable acting as an interface to modify the C++ variable.
Developers must be aware that this variable is specifically for MACD (Movement-Aware Collision Detection). It’s different from the general velocity bounds multiplier (ChaosSolverVelocityBoundsMultiplier). The MACD version is likely used in scenarios where more precise collision detection is needed for fast-moving objects.
Best practices when using this variable include:
- Only modify it if you understand the implications for MACD in your physics simulations.
- Use it in conjunction with p.Chaos.Solver.Collision.MaxVelocityBoundsExpansionMACD for fine-tuning collision detection.
- Monitor performance impacts when adjusting this value, as it may affect physics simulation speed.
Regarding the associated variable ChaosSolverVelocityBoundsMultiplierMACD:
The purpose of ChaosSolverVelocityBoundsMultiplierMACD is to store the actual value used by the Chaos solver for the MACD velocity bounds multiplier. It’s initialized with a default value of 1.0f.
This variable is used directly in the Chaos physics solver, specifically in the FPBDRigidsSolver::PrepareAdvanceBy function. When the console variable (p.Chaos.Solver.Collision.VelocityBoundsMultiplierMACD) is set to a value >= 0, the ChaosSolverVelocityBoundsMultiplierMACD value is used to set the velocity bounds expansion for MACD through the SetVelocityBoundsExpansionMACD function.
Developers should be aware that changing this variable directly in code will not persist across sessions or be adjustable at runtime. For runtime adjustments, they should use the console variable instead.
Best practices for this variable include:
- Avoid modifying it directly in code unless absolutely necessary.
- Use the console variable for runtime adjustments and testing.
- Consider the interplay between this variable and ChaosSolverMaxVelocityBoundsExpansionMACD when fine-tuning MACD behavior.
#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:349
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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;
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverVelocityBoundsMultiplierMACD
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:345
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FRealSingle ChaosSolverVelocityBoundsMultiplier = 1.0f;
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;
#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)