p.Chaos.JointConstraint.SoftAngularStiffnessScale
p.Chaos.JointConstraint.SoftAngularStiffnessScale
#Overview
name: p.Chaos.JointConstraint.SoftAngularStiffnessScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Conversion factor for soft-joint stiffness.
It is referenced in 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.JointConstraint.SoftAngularStiffnessScale is to provide a conversion factor for soft-joint stiffness in the Chaos physics engine, which is part of Unreal Engine 5’s physics system.
This setting variable is primarily used in the Chaos physics engine, specifically in the joint constraint subsystem. It’s referenced in several modules, including PhysicsCore, Engine, and the Experimental PhysicsControl plugin.
The value of this variable is set as a console variable (CVar) in the ChaosConstraintSettings.cpp file, with a default value of 100000. It can be modified at runtime through the console or configuration files.
This variable interacts closely with other joint constraint settings, particularly those related to soft constraints. It’s often used in conjunction with SoftAngularDampingScale and other stiffness and damping parameters for different types of joint constraints (linear, twist, swing).
Developers should be aware that this variable acts as a scaling factor. When applying stiffness to soft angular constraints, the actual stiffness value is multiplied by this scale. This allows for fine-tuning of the constraint behavior without changing individual constraint settings.
Best practices when using this variable include:
- Understand that it affects all soft angular constraints globally.
- Use it to adjust the overall behavior of soft angular constraints without modifying individual constraint settings.
- Be cautious when changing its value, as it can significantly impact the behavior of joint constraints in the physics simulation.
Regarding the associated variable SoftAngularStiffnessScale:
This is not a separate variable, but rather the same variable accessed through a static function in the ConstraintSettings class. It’s used in various parts of the physics engine to apply the scaling factor to soft angular constraints.
The purpose and usage of SoftAngularStiffnessScale are identical to p.Chaos.JointConstraint.SoftAngularStiffnessScale. It’s accessed through C++ code rather than as a console variable, allowing for programmatic use within the engine’s physics calculations.
Developers should use this function (ConstraintSettings::SoftAngularStiffnessScale()) when they need to apply the scaling factor in C++ code, ensuring consistency with the console variable setting throughout 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:35
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
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."));
}
FReal ConstraintSettings::JointStiffness() { return JointConstraintDefaults::JointStiffness;}
#Associated Variable and Callsites
This variable is associated with another variable named SoftAngularStiffnessScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/PhysicsControl/Source/PhysicsControl/Private/RigidBodyWithControl.cpp:999
Scope (from outer to inner):
file
function void FAnimNode_RigidBodyWithControl::ApplyCurrentConstraintProfile
Source code excerpt:
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;
JointSettings.SoftSwingDamping =
Chaos::ConstraintSettings::SoftAngularDampingScale() * Profile.ConeLimit.Damping;
JointSettings.LinearRestitution = Profile.LinearLimit.Restitution;
JointSettings.TwistRestitution = Profile.TwistLimit.Restitution;
JointSettings.SwingRestitution = Profile.ConeLimit.Restitution;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysInterface_Chaos.cpp:321
Scope (from outer to inner):
file
function void FPhysInterface_Chaos::UpdateConeLimitParams_AssumesLocked
Source code excerpt:
Constraint->SetSoftSwingLimitsEnabled(InParams.bSoftConstraint);
Constraint->SetSoftSwingStiffness(Chaos::ConstraintSettings::SoftAngularStiffnessScale() * InParams.Stiffness);
Constraint->SetSoftSwingDamping(Chaos::ConstraintSettings::SoftAngularDampingScale() * InParams.Damping);
Constraint->SetSwingContactDistance(InParams.ContactDistance);
Constraint->SetSwingRestitution(InParams.Restitution);
//Constraint->SetAngularSoftForceMode( InParams.NOT_QUITE_SURE ); // @todo(chaos)
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/Experimental/PhysInterface_Chaos.cpp:341
Scope (from outer to inner):
file
function void FPhysInterface_Chaos::UpdateTwistLimitParams_AssumesLocked
Source code excerpt:
Constraint->SetSoftTwistLimitsEnabled(InParams.bSoftConstraint);
Constraint->SetSoftTwistStiffness(Chaos::ConstraintSettings::SoftAngularStiffnessScale() * InParams.Stiffness);
Constraint->SetSoftTwistDamping(Chaos::ConstraintSettings::SoftAngularDampingScale() * InParams.Damping);
Constraint->SetTwistContactDistance(InParams.ContactDistance);
Constraint->SetTwistRestitution(InParams.Restitution);
//Constraint->SetAngularSoftForceMode( InParams.NOT_QUITE_SURE ); // @todo(chaos)
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsJointHandle_Chaos.cpp:61
Scope (from outer to inner):
file
namespace ImmediatePhysics_Chaos
function void TransferJointSettings
Source code excerpt:
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;
if (!ConstraintSettings.bSoftLinearLimitsEnabled)
{
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:20
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
int SoftAngularForceMode = (int)EJointForceMode::Acceleration;
float SoftAngularStiffnessScale = 100000;
float SoftAngularDampingScale = 1000;
float LinearBreakScale = 1.0f;
float AngularBreakScale = 1.0f;
FAutoConsoleVariableRef CVarJointStiffness(TEXT("p.Chaos.JointConstraint.JointStiffness"), JointStiffness, TEXT("Hard-joint solver stiffness."));
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:35
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
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."));
}
FReal ConstraintSettings::JointStiffness() { return JointConstraintDefaults::JointStiffness;}
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:50
Scope (from outer to inner):
file
namespace Chaos
function FReal ConstraintSettings::SoftAngularStiffnessScale
Source code excerpt:
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:28
Scope (from outer to inner):
file
namespace Chaos
class class ConstraintSettings
Source code excerpt:
static PHYSICSCORE_API int SoftAngularForceMode();
static PHYSICSCORE_API FReal SoftAngularStiffnessScale();
static PHYSICSCORE_API FReal SoftAngularDampingScale();
static PHYSICSCORE_API FReal LinearBreakScale();
static PHYSICSCORE_API FReal AngularBreakScale();
};
}