p.Chaos.JointConstraint.SoftLinearDampingScale
p.Chaos.JointConstraint.SoftLinearDampingScale
#Overview
name: p.Chaos.JointConstraint.SoftLinearDampingScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Conversion factor for soft-joint damping.
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.JointConstraint.SoftLinearDampingScale is to provide a conversion factor for soft-joint damping in the Chaos physics engine of Unreal Engine 5. This setting variable is specifically used for adjusting the damping behavior of soft linear constraints in joint physics simulations.
The Chaos physics engine, which is part of Unreal Engine’s physics system, relies on this setting variable. It is primarily used in the PhysicsCore module and the Experimental PhysicsControl plugin.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1.2f in the ChaosConstraintSettings.cpp file and can be modified at runtime using the console command system.
This variable interacts closely with other joint constraint settings, particularly SoftLinearStiffnessScale. Together, these variables control the behavior of soft linear constraints in the physics simulation.
Developers must be aware that this variable acts as a scaling factor. It doesn’t directly set the damping value but instead multiplies the damping values specified in constraint profiles or physics asset settings. This allows for global adjustments to damping behavior without modifying individual asset settings.
Best practices when using this variable include:
- Use it for fine-tuning the overall feel of soft constraints in your game.
- Be cautious when making large changes, as it can significantly affect the behavior of all soft linear constraints in the game.
- Consider using it in conjunction with SoftLinearStiffnessScale for balanced adjustments to constraint behavior.
- Test thoroughly after making changes, as it can impact the stability and realism of your physics simulations.
Regarding the associated variable SoftLinearDampingScale:
The purpose of SoftLinearDampingScale is the same as p.Chaos.JointConstraint.SoftLinearDampingScale. It’s an internal representation of the console variable within the Chaos physics engine.
This variable is used directly in the physics calculations, particularly in the Chaos::ConstraintSettings namespace. It’s accessed through a static function SoftLinearDampingScale() in the ConstraintSettings class.
The value is set by the console variable system and can be modified at runtime.
It interacts with other constraint settings in the same way as p.Chaos.JointConstraint.SoftLinearDampingScale.
Developers should be aware that this is the actual variable used in physics calculations, while p.Chaos.JointConstraint.SoftLinearDampingScale is the console interface to modify it.
Best practices for using this variable are the same as those for p.Chaos.JointConstraint.SoftLinearDampingScale, as they represent the same value in different contexts of the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:32
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
FAutoConsoleVariableRef CVarAngularDriveDampingScale(TEXT("p.Chaos.JointConstraint.AngularDriveDampingScale"), AngularDriveDampingScale, TEXT("Conversion factor for Angular drive damping."));
FAutoConsoleVariableRef CVarSoftLinearStiffnessScale(TEXT("p.Chaos.JointConstraint.SoftLinearStiffnessScale"), SoftLinearStiffnessScale, TEXT("Conversion factor for soft-joint stiffness."));
FAutoConsoleVariableRef CVarSoftLinearDampingScale(TEXT("p.Chaos.JointConstraint.SoftLinearDampingScale"), SoftLinearDampingScale, TEXT("Conversion factor for soft-joint damping."));
FAutoConsoleVariableRef CVarSoftLinearForceMode(TEXT("p.Chaos.JointConstraint.SoftLinearForceMode"), SoftLinearForceMode, TEXT("Soft Linear constraint force mode (0: Acceleration; 1: Force"));
FAutoConsoleVariableRef CVarSoftAngularForceMode(TEXT("p.Chaos.JointConstraint.SoftAngularForceMode"), SoftAngularForceMode, TEXT("Soft Angular constraint force mode (0: Acceleration; 1: Force"));
FAutoConsoleVariableRef CVarSoftAngularStiffnessScale(TEXT("p.Chaos.JointConstraint.SoftAngularStiffnessScale"), SoftAngularStiffnessScale, TEXT("Conversion factor for soft-joint stiffness."));
FAutoConsoleVariableRef CVarSoftAngularDampingScale(TEXT("p.Chaos.JointConstraint.SoftAngularDampingScale"), SoftAngularDampingScale, TEXT("Conversion factor for soft-joint damping."));
FAutoConsoleVariableRef CVarJointLinearBreakScale(TEXT("p.Chaos.JointConstraint.LinearBreakScale"), LinearBreakScale, TEXT("Conversion factory for Linear Break Theshold."));
FAutoConsoleVariableRef CVarJointAngularBreakScale(TEXT("p.Chaos.JointConstraint.AngularBreakScale"), AngularBreakScale, TEXT("Conversion factory for Angular Break Theshold."));
#Associated Variable and Callsites
This variable is associated with another variable named SoftLinearDampingScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/PhysicsControl/Source/PhysicsControl/Private/RigidBodyWithControl.cpp:997
Scope (from outer to inner):
file
function void FAnimNode_RigidBodyWithControl::ApplyCurrentConstraintProfile
Source code excerpt:
Chaos::ConstraintSettings::SoftLinearStiffnessScale() * Profile.LinearLimit.Stiffness;
JointSettings.SoftLinearDamping =
Chaos::ConstraintSettings::SoftLinearDampingScale() * Profile.LinearLimit.Damping;
JointSettings.SoftTwistStiffness =
Chaos::ConstraintSettings::SoftAngularStiffnessScale() * Profile.TwistLimit.Stiffness;
JointSettings.SoftTwistDamping =
Chaos::ConstraintSettings::SoftAngularDampingScale() * Profile.TwistLimit.Damping;
JointSettings.SoftSwingStiffness =
Chaos::ConstraintSettings::SoftAngularStiffnessScale() * Profile.ConeLimit.Stiffness;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysInterface_Chaos.cpp:301
Scope (from outer to inner):
file
function void FPhysInterface_Chaos::UpdateLinearLimitParams_AssumesLocked
Source code excerpt:
Constraint->SetSoftLinearLimitsEnabled(InParams.bSoftConstraint);
Constraint->SetSoftLinearStiffness(Chaos::ConstraintSettings::SoftLinearStiffnessScale() * InParams.Stiffness);
Constraint->SetSoftLinearDamping(Chaos::ConstraintSettings::SoftLinearDampingScale() * InParams.Damping);
Constraint->SetLinearContactDistance(InParams.ContactDistance);
Constraint->SetLinearRestitution(InParams.Restitution);
//Constraint->SetAngularSoftForceMode( InParams.NOT_QUITE_SURE ); // @todo(chaos)
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsJointHandle_Chaos.cpp:60
Scope (from outer to inner):
file
namespace ImmediatePhysics_Chaos
function void TransferJointSettings
Source code excerpt:
ConstraintSettings.bSoftSwingLimitsEnabled = ConstraintInstance->GetIsSoftSwingLimit();
ConstraintSettings.SoftLinearStiffness = Chaos::ConstraintSettings::SoftLinearStiffnessScale() * ConstraintInstance->GetSoftLinearLimitStiffness();
ConstraintSettings.SoftLinearDamping = Chaos::ConstraintSettings::SoftLinearDampingScale() * ConstraintInstance->GetSoftLinearLimitDamping();
ConstraintSettings.SoftTwistStiffness = Chaos::ConstraintSettings::SoftAngularStiffnessScale() * ConstraintInstance->GetSoftTwistLimitStiffness();
ConstraintSettings.SoftTwistDamping = Chaos::ConstraintSettings::SoftAngularDampingScale() * ConstraintInstance->GetSoftTwistLimitDamping();
ConstraintSettings.SoftSwingStiffness = Chaos::ConstraintSettings::SoftAngularStiffnessScale() * ConstraintInstance->GetSoftSwingLimitStiffness();
ConstraintSettings.SoftSwingDamping = Chaos::ConstraintSettings::SoftAngularDampingScale() * ConstraintInstance->GetSoftSwingLimitDamping();
ConstraintSettings.LinearSoftForceMode = (Chaos::ConstraintSettings::SoftLinearForceMode() == 0) ? EJointForceMode::Acceleration : EJointForceMode::Force;
ConstraintSettings.AngularSoftForceMode = (Chaos::ConstraintSettings::SoftAngularForceMode() == 0) ? EJointForceMode::Acceleration : EJointForceMode::Force;
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:17
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
int SoftLinearForceMode = (int)EJointForceMode::Acceleration;
float SoftLinearStiffnessScale = 1.5f;
float SoftLinearDampingScale = 1.2f;
int SoftAngularForceMode = (int)EJointForceMode::Acceleration;
float SoftAngularStiffnessScale = 100000;
float SoftAngularDampingScale = 1000;
float LinearBreakScale = 1.0f;
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:32
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
FAutoConsoleVariableRef CVarAngularDriveDampingScale(TEXT("p.Chaos.JointConstraint.AngularDriveDampingScale"), AngularDriveDampingScale, TEXT("Conversion factor for Angular drive damping."));
FAutoConsoleVariableRef CVarSoftLinearStiffnessScale(TEXT("p.Chaos.JointConstraint.SoftLinearStiffnessScale"), SoftLinearStiffnessScale, TEXT("Conversion factor for soft-joint stiffness."));
FAutoConsoleVariableRef CVarSoftLinearDampingScale(TEXT("p.Chaos.JointConstraint.SoftLinearDampingScale"), SoftLinearDampingScale, TEXT("Conversion factor for soft-joint damping."));
FAutoConsoleVariableRef CVarSoftLinearForceMode(TEXT("p.Chaos.JointConstraint.SoftLinearForceMode"), SoftLinearForceMode, TEXT("Soft Linear constraint force mode (0: Acceleration; 1: Force"));
FAutoConsoleVariableRef CVarSoftAngularForceMode(TEXT("p.Chaos.JointConstraint.SoftAngularForceMode"), SoftAngularForceMode, TEXT("Soft Angular constraint force mode (0: Acceleration; 1: Force"));
FAutoConsoleVariableRef CVarSoftAngularStiffnessScale(TEXT("p.Chaos.JointConstraint.SoftAngularStiffnessScale"), SoftAngularStiffnessScale, TEXT("Conversion factor for soft-joint stiffness."));
FAutoConsoleVariableRef CVarSoftAngularDampingScale(TEXT("p.Chaos.JointConstraint.SoftAngularDampingScale"), SoftAngularDampingScale, TEXT("Conversion factor for soft-joint damping."));
FAutoConsoleVariableRef CVarJointLinearBreakScale(TEXT("p.Chaos.JointConstraint.LinearBreakScale"), LinearBreakScale, TEXT("Conversion factory for Linear Break Theshold."));
FAutoConsoleVariableRef CVarJointAngularBreakScale(TEXT("p.Chaos.JointConstraint.AngularBreakScale"), AngularBreakScale, TEXT("Conversion factory for Angular Break Theshold."));
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:48
Scope (from outer to inner):
file
namespace Chaos
function FReal ConstraintSettings::SoftLinearDampingScale
Source code excerpt:
int ConstraintSettings::SoftLinearForceMode() { return JointConstraintDefaults::SoftLinearForceMode;}
FReal ConstraintSettings::SoftLinearStiffnessScale() { return JointConstraintDefaults::SoftLinearStiffnessScale;}
FReal ConstraintSettings::SoftLinearDampingScale() { return JointConstraintDefaults::SoftLinearDampingScale;}
int ConstraintSettings::SoftAngularForceMode() { return JointConstraintDefaults::SoftAngularForceMode;}
FReal ConstraintSettings::SoftAngularStiffnessScale() { return JointConstraintDefaults::SoftAngularStiffnessScale;}
FReal ConstraintSettings::SoftAngularDampingScale() { return JointConstraintDefaults::SoftAngularDampingScale;}
FReal ConstraintSettings::LinearBreakScale() { return JointConstraintDefaults::LinearBreakScale;}
FReal ConstraintSettings::AngularBreakScale() { return JointConstraintDefaults::AngularBreakScale;}
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Public/Chaos/ChaosConstraintSettings.h:25
Scope (from outer to inner):
file
namespace Chaos
class class ConstraintSettings
Source code excerpt:
static PHYSICSCORE_API int SoftLinearForceMode();
static PHYSICSCORE_API FReal SoftLinearStiffnessScale();
static PHYSICSCORE_API FReal SoftLinearDampingScale();
static PHYSICSCORE_API int SoftAngularForceMode();
static PHYSICSCORE_API FReal SoftAngularStiffnessScale();
static PHYSICSCORE_API FReal SoftAngularDampingScale();
static PHYSICSCORE_API FReal LinearBreakScale();