p.Chaos.Solver.Collision.VelocityBoundsMultiplier
p.Chaos.Solver.Collision.VelocityBoundsMultiplier
#Overview
name: p.Chaos.Solver.Collision.VelocityBoundsMultiplier
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override velocity bounds multiplier (if >= 0)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Collision.VelocityBoundsMultiplier is to control the velocity bounds multiplier in the Chaos physics solver’s collision detection system. This setting is part of Unreal Engine 5’s Chaos physics engine, which is responsible for simulating physical interactions in the game world.
This setting variable is primarily used by the Chaos physics solver subsystem within Unreal Engine 5. It’s specifically related to the collision detection module of the physics system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1.0f and can be modified at runtime using the console command system.
The associated variable ChaosSolverVelocityBoundsMultiplier interacts directly with p.Chaos.Solver.Collision.VelocityBoundsMultiplier. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the collision detection system’s performance and accuracy. A higher value may increase the collision detection range but could potentially impact performance, while a lower value might improve performance at the cost of potentially missing some collisions.
Best practices when using this variable include:
- Only modify it if you understand the implications on your game’s physics simulation.
- Test thoroughly after changing the value to ensure it doesn’t negatively impact gameplay or performance.
- Consider using different values for different scenarios or game modes if needed.
Regarding the associated variable ChaosSolverVelocityBoundsMultiplier:
The purpose of ChaosSolverVelocityBoundsMultiplier is the same as p.Chaos.Solver.Collision.VelocityBoundsMultiplier. It’s used internally within the Chaos physics solver to apply the velocity bounds multiplier.
This variable is used in the Chaos physics solver subsystem, specifically in the PrepareAdvanceBy function of the FPBDRigidsSolver class.
The value is set either through the console variable system or programmatically within the engine code.
It interacts directly with p.Chaos.Solver.Collision.VelocityBoundsMultiplier and is used in conjunction with ChaosSolverMaxVelocityBoundsExpansion to set the velocity bounds expansion for collision detection.
Developers should be aware that this variable is used in the core physics simulation loop and changes to it can have significant effects on the game’s physics behavior.
Best practices include:
- Modifying this variable only when necessary and with a clear understanding of the physics implications.
- Using the console variable system for testing and tuning, rather than hardcoding values.
- Documenting any non-default values used in production to aid in debugging and maintenance.
#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:347
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
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);
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverVelocityBoundsMultiplier
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:343
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
// @todo(chaos): move to physics project settings and set these to -1 when we are settled on values...
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);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1344
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
SetCollisionCullDistance(ChaosSolverCullDistance);
}
if ((ChaosSolverVelocityBoundsMultiplier >= 0.0f) && (ChaosSolverMaxVelocityBoundsExpansion >= 0.0f))
{
SetVelocityBoundsExpansion(ChaosSolverVelocityBoundsMultiplier, ChaosSolverMaxVelocityBoundsExpansion);
}
if ((ChaosSolverVelocityBoundsMultiplierMACD >= 0.0f) && (ChaosSolverMaxVelocityBoundsExpansionMACD >= 0.0f))
{
SetVelocityBoundsExpansionMACD(ChaosSolverVelocityBoundsMultiplierMACD, ChaosSolverMaxVelocityBoundsExpansionMACD);
}
if (ChaosSolverMaxPushOutVelocity >= 0.0f)