p.Chaos.Solver.Joint.AngleTolerance
p.Chaos.Solver.Joint.AngleTolerance
#Overview
name: p.Chaos.Solver.Joint.AngleTolerance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
AngleTolerance.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Joint.AngleTolerance is to set the angle tolerance for joint constraints in the Chaos physics solver. This setting is part of the joint simulation system within Unreal Engine’s Chaos physics engine.
The Chaos physics solver, which is part of the Experimental Chaos module in Unreal Engine 5, relies on this setting variable. Specifically, it’s used in the PBDRigidsSolver (Position Based Dynamics Rigids Solver) component of the Chaos physics system.
The value of this variable is set in the C++ code, initialized with a default value of 0.001f. It can be modified at runtime through the console variable system, as it’s registered as an FAutoConsoleVariableRef.
This variable interacts closely with other joint-related settings, such as ChaosSolverJointPositionTolerance, ChaosSolverJointMinParentMassRatio, and ChaosSolverJointMaxInertiaRatio. These variables collectively define the behavior and constraints of joints in the physics simulation.
Developers must be aware that this variable directly affects the precision of joint angle constraints in the physics simulation. A smaller value will result in tighter angle constraints, while a larger value will allow for more flexibility in joint angles.
Best practices when using this variable include:
- Adjusting it in small increments to fine-tune joint behavior.
- Testing thoroughly after modifications, as it can significantly impact the stability and realism of joint simulations.
- Considering the trade-off between simulation accuracy and performance, as tighter tolerances may require more computational resources.
Regarding the associated variable ChaosSolverJointAngleTolerance:
The purpose of ChaosSolverJointAngleTolerance is to store the actual value of the angle tolerance used in the joint calculations within the solver.
This variable is used directly in the Chaos physics solver, specifically in the PrepareAdvanceBy function of the FPBDRigidsSolver class. It’s assigned to the AngleTolerance field of the JointsSettings structure, which likely configures the joint solver for each simulation step.
The value of ChaosSolverJointAngleTolerance is set initially in the code to 0.001f, but can be modified at runtime through the console variable system.
It interacts directly with the p.Chaos.Solver.Joint.AngleTolerance console variable, essentially serving as the backing variable for this setting.
Developers should be aware that modifying ChaosSolverJointAngleTolerance will directly affect the behavior of joints in the physics simulation. It’s crucial to understand the implications of changing this value on the overall stability and realism of the simulation.
Best practices for using ChaosSolverJointAngleTolerance include:
- Modifying it through the console variable system rather than directly in code for easier testing and tuning.
- Documenting any non-default values used in production to ensure consistency across different environments or builds.
- Considering its impact alongside other joint-related settings for a holistic approach to joint behavior tuning.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:325
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverJointPositionTolerance(TEXT("p.Chaos.Solver.Joint.PositionTolerance"), ChaosSolverJointPositionTolerance, TEXT("PositionTolerance."));
FRealSingle ChaosSolverJointAngleTolerance = 0.001f;
FAutoConsoleVariableRef CVarChaosSolverJointAngleTolerance(TEXT("p.Chaos.Solver.Joint.AngleTolerance"), ChaosSolverJointAngleTolerance, TEXT("AngleTolerance."));
FRealSingle ChaosSolverJointMinParentMassRatio = 0.2f;
FAutoConsoleVariableRef CVarChaosSolverJointMinParentMassRatio(TEXT("p.Chaos.Solver.Joint.MinParentMassRatio"), ChaosSolverJointMinParentMassRatio, TEXT("6Dof joint MinParentMassRatio (if > 0)"));
FRealSingle ChaosSolverJointMaxInertiaRatio = 5.0f;
FAutoConsoleVariableRef CVarChaosSolverJointMaxInertiaRatio(TEXT("p.Chaos.Solver.Joint.MaxInertiaRatio"), ChaosSolverJointMaxInertiaRatio, TEXT("6Dof joint MaxInertiaRatio (if > 0)"));
// Collision detection cvars
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverJointAngleTolerance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:324
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FRealSingle ChaosSolverJointPositionTolerance = 0.025f;
FAutoConsoleVariableRef CVarChaosSolverJointPositionTolerance(TEXT("p.Chaos.Solver.Joint.PositionTolerance"), ChaosSolverJointPositionTolerance, TEXT("PositionTolerance."));
FRealSingle ChaosSolverJointAngleTolerance = 0.001f;
FAutoConsoleVariableRef CVarChaosSolverJointAngleTolerance(TEXT("p.Chaos.Solver.Joint.AngleTolerance"), ChaosSolverJointAngleTolerance, TEXT("AngleTolerance."));
FRealSingle ChaosSolverJointMinParentMassRatio = 0.2f;
FAutoConsoleVariableRef CVarChaosSolverJointMinParentMassRatio(TEXT("p.Chaos.Solver.Joint.MinParentMassRatio"), ChaosSolverJointMinParentMassRatio, TEXT("6Dof joint MinParentMassRatio (if > 0)"));
FRealSingle ChaosSolverJointMaxInertiaRatio = 5.0f;
FAutoConsoleVariableRef CVarChaosSolverJointMaxInertiaRatio(TEXT("p.Chaos.Solver.Joint.MaxInertiaRatio"), ChaosSolverJointMaxInertiaRatio, TEXT("6Dof joint MaxInertiaRatio (if > 0)"));
// Collision detection cvars
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1296
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
JointsSettings.NumIterationsAtMaxSolverStiffness = ChaosSolverJointNumIterationsAtMaxSolverStiffness;
JointsSettings.PositionTolerance = ChaosSolverJointPositionTolerance;
JointsSettings.AngleTolerance = ChaosSolverJointAngleTolerance;
JointsSettings.MinParentMassRatio = ChaosSolverJointMinParentMassRatio;
JointsSettings.MaxInertiaRatio = ChaosSolverJointMaxInertiaRatio;
JointsSettings.bSolvePositionLast = bChaosSolverJointSolvePositionLast;
JointsSettings.bUsePositionBasedDrives = bChaosSolverJointUsePositionBasedDrives;
JointsSettings.NumShockPropagationIterations = ChaosSolverJointNumShockProagationIterations;
JointsSettings.ShockPropagationOverride = ChaosSolverJointShockPropagation;