p.Chaos.CollisionSpring.FalloffMultiplier

p.Chaos.CollisionSpring.FalloffMultiplier

#Overview

name: p.Chaos.CollisionSpring.FalloffMultiplier

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.CollisionSpring.FalloffMultiplier is to control the tangential distance away from a triangle (scaled by thickness) beyond which a point isn’t considered to be kinematically colliding in Unreal Engine’s Chaos physics system. This setting variable is primarily used in the collision detection and resolution process for soft body dynamics.

This setting variable is utilized by the Chaos physics system, specifically within the soft body dynamics module. It’s part of the experimental Chaos namespace, indicating that it’s used in the newer, more advanced physics engine in Unreal Engine 5.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands. This allows for easy tweaking and debugging of the physics system.

The associated variable KinematicColliderFalloffMultiplier directly interacts with p.Chaos.CollisionSpring.FalloffMultiplier. They share the same value, with KinematicColliderFalloffMultiplier being the actual variable used in the physics calculations.

Developers should be aware that this variable affects the collision detection range for kinematic collisions in soft body simulations. Increasing the value will extend the range at which points are considered to be colliding, which could potentially increase computation time but may provide more stable simulations in some cases.

Best practices when using this variable include:

  1. Start with the default value (1.0f) and adjust only if necessary.
  2. Monitor performance impacts when changing this value, especially in complex scenes with many soft body interactions.
  3. Use in conjunction with other collision spring settings (like MaxDepthMultiplier) for fine-tuning collision behavior.

Regarding the associated variable KinematicColliderFalloffMultiplier:

Developers should consider the interplay between this variable and other collision settings when fine-tuning soft body physics behavior in their games or simulations.

#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:33

Scope: file

Source code excerpt:


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 {

#Associated Variable and Callsites

This variable is associated with another variable named KinematicColliderFalloffMultiplier. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:26

Scope: file

Source code excerpt:

#if UE_BUILD_SHIPPING
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 {

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:707

Scope (from outer to inner):

file
namespace    Chaos::Softs
function     void FPBDCollisionSpringConstraintsBase::ApplyKinematicConstraints

Source code excerpt:

				ThicknessWeighted.GetMapValues().GetData(),
				KinematicColliderThickness,
				KinematicColliderFalloffMultiplier,
				KinematicColliderMaxDepthMultiplier,
				KinematicColliderStiffness,
				KinematicColliderFrictionCoefficient.HasWeightMap(),
				reinterpret_cast<const ispc::FVector2f&>(KinematicColliderFrictionCoefficient.GetOffsetRange()),
				KinematicColliderFrictionCoefficient.GetMapValues().GetData(),
				Offset,

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:720

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(),

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionSpringConstraintsBase.cpp:768

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)