p.Chaos.JointConstraint.SoftAngularForceMode
p.Chaos.JointConstraint.SoftAngularForceMode
#Overview
name: p.Chaos.JointConstraint.SoftAngularForceMode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Soft Angular constraint force mode (0: Acceleration; 1: Force
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.JointConstraint.SoftAngularForceMode is to control the force mode for soft angular constraints in the Chaos physics engine. This setting is part of the joint constraint system in Unreal Engine’s physics simulation.
-
This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s physics system. It’s specifically related to joint constraints and their behavior.
-
The value of this variable is set through a console variable (CVar) in the ChaosConstraintSettings.cpp file. It can be changed at runtime using console commands or through configuration files.
-
This variable interacts closely with other joint constraint settings, particularly SoftLinearForceMode. They are often used together to define the behavior of soft constraints in both linear and angular dimensions.
-
Developers should be aware that this variable determines whether the soft angular constraint uses acceleration-based or force-based calculations. A value of 0 corresponds to acceleration mode, while 1 corresponds to force mode.
-
Best practices when using this variable include:
- Considering the desired behavior of your joint constraints and choosing the appropriate mode.
- Testing both modes to see which provides better results for your specific use case.
- Being consistent in using either acceleration or force mode across both linear and angular constraints unless there’s a specific reason not to.
Regarding the associated variable SoftAngularForceMode:
-
Its purpose is the same as p.Chaos.JointConstraint.SoftAngularForceMode, but it’s the internal representation used within the code.
-
This variable is used directly in the physics simulation code, particularly in the RigidBodyWithControl and ImmediatePhysicsJointHandle_Chaos components.
-
Its value is set based on the p.Chaos.JointConstraint.SoftAngularForceMode CVar.
-
It interacts with the EJointForceMode enum, determining whether EJointForceMode::Acceleration or EJointForceMode::Force is used.
-
Developers should be aware that changes to p.Chaos.JointConstraint.SoftAngularForceMode will directly affect this variable’s value and thus the behavior of soft angular constraints in the simulation.
-
Best practices include ensuring that any code that directly uses this variable is updated if changes are made to the force mode setting, and considering the implications on physics behavior when modifying this value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:34
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
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 SoftAngularForceMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/PhysicsControl/Source/PhysicsControl/Private/RigidBodyWithControl.cpp:991
Scope (from outer to inner):
file
function void FAnimNode_RigidBodyWithControl::ApplyCurrentConstraintProfile
Source code excerpt:
JointSettings.LinearSoftForceMode = (ConstraintSettings::SoftLinearForceMode() == 0) ?
EJointForceMode::Acceleration : EJointForceMode::Force;
JointSettings.AngularSoftForceMode = (ConstraintSettings::SoftAngularForceMode() == 0) ?
EJointForceMode::Acceleration : EJointForceMode::Force;
JointSettings.SoftLinearStiffness =
Chaos::ConstraintSettings::SoftLinearStiffnessScale() * Profile.LinearLimit.Stiffness;
JointSettings.SoftLinearDamping =
Chaos::ConstraintSettings::SoftLinearDampingScale() * Profile.LinearLimit.Damping;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsJointHandle_Chaos.cpp:66
Scope (from outer to inner):
file
namespace ImmediatePhysics_Chaos
function void TransferJointSettings
Source code excerpt:
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)
{
ConstraintSettings.LinearRestitution = Profile.LinearLimit.Restitution;
ConstraintSettings.LinearContactDistance = Profile.LinearLimit.ContactDistance;
}
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:19
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
float SoftLinearDampingScale = 1.2f;
int SoftAngularForceMode = (int)EJointForceMode::Acceleration;
float SoftAngularStiffnessScale = 100000;
float SoftAngularDampingScale = 1000;
float LinearBreakScale = 1.0f;
float AngularBreakScale = 1.0f;
#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:34
Scope (from outer to inner):
file
namespace Chaos
namespace JointConstraintDefaults
Source code excerpt:
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:49
Scope (from outer to inner):
file
namespace Chaos
function int ConstraintSettings::SoftAngularForceMode
Source code excerpt:
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:27
Scope (from outer to inner):
file
namespace Chaos
class class ConstraintSettings
Source code excerpt:
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();
static PHYSICSCORE_API FReal AngularBreakScale();
};