p.Chaos.JointConstraint.AngularBreakScale

p.Chaos.JointConstraint.AngularBreakScale

#Overview

name: p.Chaos.JointConstraint.AngularBreakScale

This variable is created as a Console Variable (cvar).

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.JointConstraint.AngularBreakScale is to provide a conversion factor for the Angular Break Threshold in the Chaos physics engine’s joint constraint system. This setting variable is used to scale the angular break threshold of joint constraints, which determines at what point a joint will break under rotational stress.

This setting variable is primarily used in the Chaos physics engine, which is part of Unreal Engine’s physics system. It is utilized in the PhysicsCore module and the Experimental PhysicsControl plugin.

The value of this variable is set through an FAutoConsoleVariableRef in the ChaosConstraintSettings.cpp file. This means it can be adjusted at runtime through console commands or configuration files.

The p.Chaos.JointConstraint.AngularBreakScale interacts closely with the AngularBreakScale variable. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable directly affects the behavior of joint constraints in the physics simulation. Adjusting this value will change how easily joints break under rotational forces. A higher value will make joints more resistant to breaking, while a lower value will make them break more easily.

Best practices when using this variable include:

  1. Carefully testing any changes to ensure desired physics behavior.
  2. Considering the impact on gameplay and visual fidelity when adjusting this value.
  3. Documenting any custom values used in project settings for consistency across the development team.

Regarding the associated variable AngularBreakScale:

The purpose of AngularBreakScale is identical to p.Chaos.JointConstraint.AngularBreakScale. It’s used internally within the Chaos physics engine to scale the angular break threshold of joint constraints.

This variable is used in various parts of the physics system, including the RigidBodyWithControl and ImmediatePhysics subsystems.

The value of AngularBreakScale is set to match p.Chaos.JointConstraint.AngularBreakScale, allowing for consistent behavior across different parts of the engine.

AngularBreakScale interacts with other physics-related variables, such as LinearBreakScale, and is often used in conjunction with settings like bAngularBreakable to determine joint breaking behavior.

Developers should be aware that this variable is used in core physics calculations and should be treated with the same care as p.Chaos.JointConstraint.AngularBreakScale.

Best practices for AngularBreakScale are the same as for p.Chaos.JointConstraint.AngularBreakScale, emphasizing consistent use across the project and thorough testing of any adjustments.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:38

Scope (from outer to inner):

file
namespace    Chaos
namespace    JointConstraintDefaults

Source code excerpt:

		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;}
	FReal ConstraintSettings::LinearDriveStiffnessScale() { return JointConstraintDefaults::LinearDriveStiffnessScale;}
	FReal ConstraintSettings::LinearDriveDampingScale() { return JointConstraintDefaults::LinearDriveDampingScale;}
	FReal ConstraintSettings::AngularDriveStiffnessScale() { return JointConstraintDefaults::AngularDriveStiffnessScale;}

#Associated Variable and Callsites

This variable is associated with another variable named AngularBreakScale. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Experimental/PhysicsControl/Source/PhysicsControl/Private/RigidBodyWithControl.cpp:1084

Scope (from outer to inner):

file
function     void FAnimNode_RigidBodyWithControl::ApplyCurrentConstraintProfile

Source code excerpt:


					JointSettings.AngularBreakTorque = Profile.bAngularBreakable ? 
						Chaos::ConstraintSettings::AngularBreakScale() * Profile.AngularBreakThreshold : FLT_MAX;
					JointSettings.AngularPlasticityLimit = Profile.bAngularPlasticity ? 
						FMath::Clamp((float)Profile.AngularPlasticityThreshold, 0.0f, 1.0f) : FLT_MAX;;

					JointSettings.ContactTransferScale = Profile.ContactTransferScale;

					ConstraintHandle->SetSettings(JointSettings);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ImmediatePhysics/ImmediatePhysicsChaos/ImmediatePhysicsJointHandle_Chaos.cpp:119

Scope (from outer to inner):

file
namespace    ImmediatePhysics_Chaos
function     void TransferJointSettings

Source code excerpt:

		ConstraintSettings.LinearBreakForce = (Profile.bLinearBreakable) ? Chaos::ConstraintSettings::LinearBreakScale() * Profile.LinearBreakThreshold : FLT_MAX;
		ConstraintSettings.LinearPlasticityLimit = (Profile.bLinearPlasticity) ? FMath::Clamp((float)Profile.LinearPlasticityThreshold, 0.f, 1.f) : FLT_MAX;
		ConstraintSettings.AngularBreakTorque = (Profile.bAngularBreakable) ? Chaos::ConstraintSettings::AngularBreakScale() * Profile.AngularBreakThreshold : FLT_MAX;
		ConstraintSettings.AngularPlasticityLimit = (Profile.bAngularPlasticity) ? Profile.AngularPlasticityThreshold : FLT_MAX;

		ConstraintSettings.ContactTransferScale = 0.0f;


		// UE Disables Soft Limits when the Limit is less than some threshold. This is not necessary in Chaos but for now we also do it for parity's sake (See FLinearConstraint::UpdateLinearLimit_AssumesLocked).

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:24

Scope (from outer to inner):

file
namespace    Chaos
namespace    JointConstraintDefaults

Source code excerpt:


		float LinearBreakScale = 1.0f;
		float AngularBreakScale = 1.0f;

		FAutoConsoleVariableRef CVarJointStiffness(TEXT("p.Chaos.JointConstraint.JointStiffness"), JointStiffness, TEXT("Hard-joint solver stiffness."));
		FAutoConsoleVariableRef CVarLinearDriveStiffnessScale(TEXT("p.Chaos.JointConstraint.LinearDriveStiffnessScale"), LinearDriveStiffnessScale, TEXT("Conversion factor for Linear drive stiffness."));
		FAutoConsoleVariableRef CVarLinearDriveDampingScale(TEXT("p.Chaos.JointConstraint.LinaearDriveDampingScale"), LinearDriveDampingScale, TEXT("Conversion factor for Linear drive damping."));
		FAutoConsoleVariableRef CVarAngularDriveStiffnessScale(TEXT("p.Chaos.JointConstraint.AngularDriveStiffnessScale"), AngularDriveStiffnessScale, TEXT("Conversion factor for Angular drive stiffness."));
		FAutoConsoleVariableRef CVarAngularDriveDampingScale(TEXT("p.Chaos.JointConstraint.AngularDriveDampingScale"), AngularDriveDampingScale, TEXT("Conversion factor for Angular drive damping."));

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:38

Scope (from outer to inner):

file
namespace    Chaos
namespace    JointConstraintDefaults

Source code excerpt:

		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;}
	FReal ConstraintSettings::LinearDriveStiffnessScale() { return JointConstraintDefaults::LinearDriveStiffnessScale;}
	FReal ConstraintSettings::LinearDriveDampingScale() { return JointConstraintDefaults::LinearDriveDampingScale;}
	FReal ConstraintSettings::AngularDriveStiffnessScale() { return JointConstraintDefaults::AngularDriveStiffnessScale;}

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosConstraintSettings.cpp:53

Scope (from outer to inner):

file
namespace    Chaos
function     FReal ConstraintSettings::AngularBreakScale

Source code excerpt:

	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:32

Scope (from outer to inner):

file
namespace    Chaos
class        class ConstraintSettings

Source code excerpt:


		static PHYSICSCORE_API FReal LinearBreakScale();
		static PHYSICSCORE_API FReal AngularBreakScale();
	};
}