p.Chaos.CollisionSpring.MaxDepthMultiplier
p.Chaos.CollisionSpring.MaxDepthMultiplier
#Overview
name: p.Chaos.CollisionSpring.MaxDepthMultiplier
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Penetration depth beyond which we ignore the kinematic collision (so you don\'t push through the wrong side)
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.CollisionSpring.MaxDepthMultiplier is to control the maximum penetration depth for kinematic collisions in the Chaos physics system. It’s used to prevent objects from pushing through the wrong side of a collision surface.
This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics simulation.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through the console. It’s initialized with a default value of 10.0f.
The variable interacts closely with KinematicColliderMaxDepthMultiplier, which is the actual variable used in the physics calculations. p.Chaos.CollisionSpring.MaxDepthMultiplier is used to set and update the value of KinematicColliderMaxDepthMultiplier.
Developers should be aware that this variable directly impacts the behavior of kinematic collisions in the Chaos physics system. Setting it too low might result in objects penetrating through surfaces they shouldn’t, while setting it too high might cause unexpected collision behavior.
Best practices when using this variable include:
- Carefully tuning its value based on the specific needs of your game or simulation.
- Testing thoroughly with different scenarios to ensure desired collision behavior.
- Consider exposing it as a tweakable parameter for fine-tuning physics behavior.
Regarding the associated variable KinematicColliderMaxDepthMultiplier:
The purpose of KinematicColliderMaxDepthMultiplier is to store and provide the actual value used in physics calculations for determining the maximum penetration depth for kinematic collisions.
This variable is used directly in the Chaos physics subsystem, specifically in the FPBDCollisionSpringConstraintsBase::ApplyKinematicConstraints function.
Its value is set by the console variable p.Chaos.CollisionSpring.MaxDepthMultiplier.
KinematicColliderMaxDepthMultiplier interacts with other physics-related variables such as KinematicColliderThickness and KinematicColliderFalloffMultiplier to determine collision behavior.
Developers should be aware that this variable is used to calculate the MaxDepth in collision calculations, which is crucial for preventing objects from penetrating too deeply into collision surfaces.
Best practices for using this variable include:
- Avoiding direct modification of this variable, instead use the console variable p.Chaos.CollisionSpring.MaxDepthMultiplier to change its value.
- Monitoring its value during physics simulations to ensure it’s providing the desired collision behavior.
- Considering its impact on performance, as very high values might lead to more complex collision calculations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:36
Scope: file
Source code excerpt:
Chaos::Softs::FSolverReal KinematicColliderMaxDepthMultiplier = (Chaos::Softs::FSolverReal)10.f;
FAutoConsoleVariableRef CVarChaosCollisionSpringMaxDepthMultiplier(TEXT("p.Chaos.CollisionSpring.MaxDepthMultiplier"), KinematicColliderMaxDepthMultiplier, TEXT("Penetration depth beyond which we ignore the kinematic collision (so you don't push through the wrong side)"));
#endif
namespace Chaos::Softs {
static TConstArrayView<FSolverVec3> GetConstArrayView(const FSolverParticles& Particles, int32 Offset, int32 NumParticles, const TArray<FSolverVec3>* const Data)
{
#Associated Variable and Callsites
This variable is associated with another variable named KinematicColliderMaxDepthMultiplier
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:27
Scope: file
Source code excerpt:
static constexpr Chaos::Softs::FSolverReal KinematicColliderMaxTimer = (Chaos::Softs::FSolverReal)0.1f;
static constexpr Chaos::Softs::FSolverReal KinematicColliderFalloffMultiplier = (Chaos::Softs::FSolverReal)1.f;
static constexpr Chaos::Softs::FSolverReal KinematicColliderMaxDepthMultiplier = (Chaos::Softs::FSolverReal)10.f;
#else
Chaos::Softs::FSolverReal KinematicColliderMaxTimer = (Chaos::Softs::FSolverReal)0.1f;
FAutoConsoleVariableRef CVarChaosCollisionSpringMaxTimer(TEXT("p.Chaos.CollisionSpring.MaxTimer"), KinematicColliderMaxTimer, TEXT("Amount of time (in seconds) to remember a kinematic collision connection after it has moved more than Thickness away. Increasing this can reduce jitter at the cost of more computation."));
Chaos::Softs::FSolverReal KinematicColliderFalloffMultiplier = (Chaos::Softs::FSolverReal)1.f;
FAutoConsoleVariableRef CVarChaosCollisionSpringFalloffMultiplier(TEXT("p.Chaos.CollisionSpring.FalloffMultiplier"), KinematicColliderFalloffMultiplier, TEXT("Tangential distance away from a triangle (scaled by thickness) beyond which a point isn't considered to be kinematically colliding"));
Chaos::Softs::FSolverReal KinematicColliderMaxDepthMultiplier = (Chaos::Softs::FSolverReal)10.f;
FAutoConsoleVariableRef CVarChaosCollisionSpringMaxDepthMultiplier(TEXT("p.Chaos.CollisionSpring.MaxDepthMultiplier"), KinematicColliderMaxDepthMultiplier, TEXT("Penetration depth beyond which we ignore the kinematic collision (so you don't push through the wrong side)"));
#endif
namespace Chaos::Softs {
static TConstArrayView<FSolverVec3> GetConstArrayView(const FSolverParticles& Particles, int32 Offset, int32 NumParticles, const TArray<FSolverVec3>* const Data)
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:708
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDCollisionSpringConstraintsBase::ApplyKinematicConstraints
Source code excerpt:
KinematicColliderThickness,
KinematicColliderFalloffMultiplier,
KinematicColliderMaxDepthMultiplier,
KinematicColliderStiffness,
KinematicColliderFrictionCoefficient.HasWeightMap(),
reinterpret_cast<const ispc::FVector2f&>(KinematicColliderFrictionCoefficient.GetOffsetRange()),
KinematicColliderFrictionCoefficient.GetMapValues().GetData(),
Offset,
KinematicCollidingParticles.Num()
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:721
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDCollisionSpringConstraintsBase::ApplyKinematicConstraints
Source code excerpt:
const FSolverReal Height = (FSolverReal)ThicknessWeighted + KinematicColliderThickness;
const FSolverReal OneOverTangentialFalloffDist = (FSolverReal)1.f / FMath::Max(KinematicColliderFalloffMultiplier * Height, UE_KINDA_SMALL_NUMBER);
const FSolverReal MaxDepth = -Height * KinematicColliderMaxDepthMultiplier;
if (KinematicColliderFrictionCoefficient.HasWeightMap())
{
ispc::ApplyKinematicCollisionSpringConstraintsWithKinematicFrictionMap(
(ispc::FVector4f*)Particles.GetPAndInvM().GetData(),
(const ispc::FVector3f*)Particles.XArray().GetData(),
KinematicCollidingParticles.GetData(),
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:769
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDCollisionSpringConstraintsBase::ApplyKinematicConstraints
Source code excerpt:
const FSolverReal Height = ParticleThickness + KinematicColliderThickness;
const FSolverReal OneOverTangentialFalloffDist = (FSolverReal)1.f / FMath::Max(KinematicColliderFalloffMultiplier * Height, UE_KINDA_SMALL_NUMBER);
const FSolverReal MaxDepth = -Height * KinematicColliderMaxDepthMultiplier;
for (int32 EIndex = 0; EIndex < MaxKinematicConnectionsPerPoint; ++EIndex)
{
const int32 ElemIndex = KinematicColliderElements[Index][EIndex];
if (ElemIndex == INDEX_NONE)
{