p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp
p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp
#Overview
name: p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Clamp of maximum value of the stiffness clamp[def:1.0]
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp is to set a maximum limit on the stiffness value for collision transfers in joint constraints within the Chaos physics solver.
This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics simulation module. It’s specifically related to the joint collision handling in the physics solver.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 1.0f and can be modified at runtime using console commands.
This variable interacts closely with TransferCollisionsStiffnessClamp, which is the actual variable holding the value. The console variable p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp is used to expose and control this value.
Developers should be aware that this variable affects the stability and behavior of joint constraints in physics simulations. Setting it too high might lead to instability, while setting it too low might result in less responsive joint behavior.
Best practices when using this variable include:
- Start with the default value (1.0) and adjust gradually.
- Test thoroughly after making changes, as it can significantly impact physics behavior.
- Consider different scenarios and edge cases when tuning this value.
Regarding the associated variable TransferCollisionsStiffnessClamp:
This is the actual variable that holds the stiffness clamp value. It’s used directly in the physics calculations, specifically in the TransferJointConstraintCollisions function of the Chaos solver.
The value of TransferCollisionsStiffnessClamp is used to clamp the collision constraint stiffness, ensuring it doesn’t exceed a certain maximum value. This helps maintain stability in the physics simulation.
Developers should note that there’s a debug option (TransferCollisionsDebugTestAgainstMaxClamp) that, when enabled, forces all joint collision constraint settings to use the maximum clamp value. This can be useful for validating stability under extreme conditions.
When working with TransferCollisionsStiffnessClamp, developers should:
- Ensure it’s always a positive value.
- Be cautious when modifying it, as it directly affects the physics simulation’s behavior and stability.
- Use the debug option (TransferCollisionsDebugTestAgainstMaxClamp) to test edge cases and ensure stability under maximum stiffness conditions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:92
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FRealSingle TransferCollisionsStiffnessClamp = 1.0f;
FAutoConsoleVariableRef CVarTransferCollisionsStiffnessClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp"), TransferCollisionsStiffnessClamp, TEXT("Clamp of maximum value of the stiffness clamp[def:1.0]"));
bool TransferCollisionsDebugTestAgainstMaxClamp = false;
FAutoConsoleVariableRef CVarTransferCollisionsDebugTestAgainstMaxClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp"), TransferCollisionsDebugTestAgainstMaxClamp, TEXT("Force all joint collision constraint settings to max clamp value to validate stability [def:false]"));
bool DoFinalProbeNarrowPhase = true;
FAutoConsoleVariableRef CVarDoFinalProbeNarrowPhase(TEXT("p.Chaos.Solver.DoFinalProbeNarrowPhase"), DoFinalProbeNarrowPhase, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named TransferCollisionsStiffnessClamp
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:91
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarTransferCollisionsKinematicScale(TEXT("p.Chaos.Solver.Joint.TransferCollisionsKinematicScale"), TransferCollisionsKinematicScale, TEXT("Scale to apply to collision transfers between kinematic bodies [def:1.0]"));
FRealSingle TransferCollisionsStiffnessClamp = 1.0f;
FAutoConsoleVariableRef CVarTransferCollisionsStiffnessClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsStiffnessClamp"), TransferCollisionsStiffnessClamp, TEXT("Clamp of maximum value of the stiffness clamp[def:1.0]"));
bool TransferCollisionsDebugTestAgainstMaxClamp = false;
FAutoConsoleVariableRef CVarTransferCollisionsDebugTestAgainstMaxClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp"), TransferCollisionsDebugTestAgainstMaxClamp, TEXT("Force all joint collision constraint settings to max clamp value to validate stability [def:false]"));
bool DoFinalProbeNarrowPhase = true;
FAutoConsoleVariableRef CVarDoFinalProbeNarrowPhase(TEXT("p.Chaos.Solver.DoFinalProbeNarrowPhase"), DoFinalProbeNarrowPhase, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:1285
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionGBF::TransferJointConstraintCollisions
lambda-function
Source code excerpt:
if (TransferCollisionsDebugTestAgainstMaxClamp)
{
CollisionConstraintStiffness = TransferCollisionsStiffnessClamp;
}
if (CollisionParticleA.Get() && CollisionParticleA->ObjectState() != EObjectStateType::Dynamic)
{
if (ensureMsgf(TransferCollisionsKinematicScale > 0, TEXT("Zero or Negative TransferCollisionsKinematicScale")))
{
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:1295
Scope (from outer to inner):
file
function void FPBDRigidsEvolutionGBF::TransferJointConstraintCollisions
lambda-function
Source code excerpt:
}
}
TransferedConstraint->SetStiffness(FMath::Clamp(CollisionConstraintStiffness, (FReal)0.f, TransferCollisionsStiffnessClamp));
FParticlePairMidPhase* MidPhase = CollisionAllocator.GetParticlePairMidPhase(CollisionParticleA->Handle(), CollisionParticleB->Handle());
MidPhase->InjectCollision(*TransferedConstraint);
return ECollisionVisitorResult::Continue;
});