p.Chaos.ImmPhys.Joint.Stiffness
p.Chaos.ImmPhys.Joint.Stiffness
#Overview
name: p.Chaos.ImmPhys.Joint.Stiffness
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
6Dof joint stiffness override (if > 0).
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.ImmPhys.Joint.Stiffness is to override the stiffness of 6-degree-of-freedom (6Dof) joints in the Chaos Immediate Physics system. This setting variable is part of the physics simulation system in Unreal Engine 5, specifically the Chaos physics engine.
The Unreal Engine subsystem that relies on this setting variable is the Immediate Physics system within the Chaos physics engine. This can be seen from the file location and namespace where the variable is used: ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp.
The value of this variable is set through a console variable (CVar) system. It’s defined using FAutoConsoleVariableRef, which allows it to be changed at runtime through console commands or configuration files.
This variable interacts with several other joint-related variables, such as ChaosImmediate_Joint_LinearProjection, ChaosImmediate_Joint_AngularProjection, and others. It’s used to override the linear, twist, and swing stiffness of the joints when its value is greater than 0.
Developers must be aware that this variable only takes effect when its value is greater than 0. If it’s 0 or negative, it won’t override the default joint stiffness values.
Best practices when using this variable include:
- Use it for fine-tuning joint behavior in specific scenarios where the default stiffness isn’t suitable.
- Be cautious when changing this value, as it affects the overall stability and behavior of jointed objects in the physics simulation.
- Test thoroughly after adjusting this value to ensure it doesn’t introduce unexpected behavior or instabilities in the physics simulation.
Regarding the associated variable ChaosImmediate_Joint_Stiffness:
This is the actual variable that stores the stiffness value. It’s initialized to -1.0f, which means it won’t override the default stiffness unless explicitly set to a positive value. The console variable p.Chaos.ImmPhys.Joint.Stiffness is linked to this variable, allowing it to be modified at runtime.
ChaosImmediate_Joint_Stiffness is used directly in the physics simulation code to override the LinearStiffness, TwistStiffness, and SwingStiffness of the joints. This indicates that a single stiffness value is applied to all these aspects of the joint when overridden.
Developers should be aware that changing ChaosImmediate_Joint_Stiffness will affect multiple aspects of joint behavior simultaneously. If more granular control is needed, separate variables for linear, twist, and swing stiffness might be more appropriate.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:124
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarChaosImmPhysJointAngularProjection(TEXT("p.Chaos.ImmPhys.Joint.AngularProjection"), ChaosImmediate_Joint_AngularProjection, TEXT("6Dof joint projection amount override (if >= 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointShockPropagation(TEXT("p.Chaos.ImmPhys.Joint.ShockPropagation"), ChaosImmediate_Joint_ShockPropagation, TEXT("6Dof joint shock propagation override (if >= 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointStiffness(TEXT("p.Chaos.ImmPhys.Joint.Stiffness"), ChaosImmediate_Joint_Stiffness, TEXT("6Dof joint stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftLinearStiffness(TEXT("p.Chaos.ImmPhys.Joint.SoftLinearStiffness"), ChaosImmediate_Joint_SoftLinearStiffness, TEXT("6Dof joint soft linear stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftTwistStiffness(TEXT("p.Chaos.ImmPhys.Joint.SoftTwistStiffness"), ChaosImmediate_Joint_SoftTwistStiffness, TEXT("6Dof joint SoftTwist stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftTwistDamping(TEXT("p.Chaos.ImmPhys.Joint.SoftTwistDamping"), ChaosImmediate_Joint_SoftTwistDamping, TEXT("6Dof joint SoftTwist damping override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftSwingStiffness(TEXT("p.Chaos.ImmPhys.Joint.SoftSwingStiffness"), ChaosImmediate_Joint_SoftSwingStiffness, TEXT("6Dof joint SoftSwing stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftSwingDamping(TEXT("p.Chaos.ImmPhys.Joint.SoftSwingDamping"), ChaosImmediate_Joint_SoftSwingDamping, TEXT("6Dof joint SoftSwing damping override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointLinearDriveStiffness(TEXT("p.Chaos.ImmPhys.Joint.LinearDriveStiffness"), ChaosImmediate_Joint_LinearDriveStiffness, TEXT("6Dof joint drive stiffness override (if > 0)."));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosImmediate_Joint_Stiffness
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:100
Scope: file
Source code excerpt:
Chaos::FRealSingle ChaosImmediate_Joint_AngularProjection = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_ShockPropagation = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_Stiffness = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_SoftLinearStiffness = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_SoftTwistStiffness = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_SoftTwistDamping = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_SoftSwingStiffness = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_SoftSwingDamping = -1.0f;
Chaos::FRealSingle ChaosImmediate_Joint_LinearDriveStiffness = -1.0f;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:124
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarChaosImmPhysJointAngularProjection(TEXT("p.Chaos.ImmPhys.Joint.AngularProjection"), ChaosImmediate_Joint_AngularProjection, TEXT("6Dof joint projection amount override (if >= 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointShockPropagation(TEXT("p.Chaos.ImmPhys.Joint.ShockPropagation"), ChaosImmediate_Joint_ShockPropagation, TEXT("6Dof joint shock propagation override (if >= 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointStiffness(TEXT("p.Chaos.ImmPhys.Joint.Stiffness"), ChaosImmediate_Joint_Stiffness, TEXT("6Dof joint stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftLinearStiffness(TEXT("p.Chaos.ImmPhys.Joint.SoftLinearStiffness"), ChaosImmediate_Joint_SoftLinearStiffness, TEXT("6Dof joint soft linear stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftTwistStiffness(TEXT("p.Chaos.ImmPhys.Joint.SoftTwistStiffness"), ChaosImmediate_Joint_SoftTwistStiffness, TEXT("6Dof joint SoftTwist stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftTwistDamping(TEXT("p.Chaos.ImmPhys.Joint.SoftTwistDamping"), ChaosImmediate_Joint_SoftTwistDamping, TEXT("6Dof joint SoftTwist damping override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftSwingStiffness(TEXT("p.Chaos.ImmPhys.Joint.SoftSwingStiffness"), ChaosImmediate_Joint_SoftSwingStiffness, TEXT("6Dof joint SoftSwing stiffness override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointSoftSwingDamping(TEXT("p.Chaos.ImmPhys.Joint.SoftSwingDamping"), ChaosImmediate_Joint_SoftSwingDamping, TEXT("6Dof joint SoftSwing damping override (if > 0)."));
FAutoConsoleVariableRef CVarChaosImmPhysJointLinearDriveStiffness(TEXT("p.Chaos.ImmPhys.Joint.LinearDriveStiffness"), ChaosImmediate_Joint_LinearDriveStiffness, TEXT("6Dof joint drive stiffness override (if > 0)."));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsSimulation_Chaos.cpp:880
Scope (from outer to inner):
file
namespace ImmediatePhysics_Chaos
function void FSimulation::Simulate
Source code excerpt:
JointsSettings.bEnableSwingLimits = ChaosImmediate_Joint_EnableSwingLimits != 0;
JointsSettings.bEnableDrives = ChaosImmediate_Joint_EnableDrives != 0;
JointsSettings.LinearStiffnessOverride = ChaosImmediate_Joint_Stiffness;
JointsSettings.TwistStiffnessOverride = ChaosImmediate_Joint_Stiffness;
JointsSettings.SwingStiffnessOverride = ChaosImmediate_Joint_Stiffness;
JointsSettings.LinearProjectionOverride = ChaosImmediate_Joint_LinearProjection;
JointsSettings.AngularProjectionOverride = ChaosImmediate_Joint_AngularProjection;
JointsSettings.ShockPropagationOverride = ChaosImmediate_Joint_ShockPropagation;
JointsSettings.SoftLinearStiffnessOverride = ChaosImmediate_Joint_SoftLinearStiffness;
JointsSettings.SoftTwistStiffnessOverride = ChaosImmediate_Joint_SoftTwistStiffness;
JointsSettings.SoftTwistDampingOverride = ChaosImmediate_Joint_SoftTwistDamping;