p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution
p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution
#Overview
name: p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Apply restitution only if initial velocity is higher than this threshold (used in Quasipbd)
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution is to set a threshold for applying restitution in joint constraints within the Chaos physics system of Unreal Engine 5. This variable is specifically used for angular velocity calculations in joint physics simulations.
This setting variable is primarily used in the Chaos physics subsystem, which is part of the Experimental module in Unreal Engine 5. It’s specifically utilized in the joint constraint solver components of the Chaos physics system.
The value of this variable is set in the JointConstraintsCVars.cpp file, with a default value of 1e-2f (0.01). It’s exposed as a console variable, allowing developers to adjust it at runtime or through configuration files.
The associated variable Chaos_Joint_AngularVelocityThresholdToApplyRestitution directly interacts with p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution. They share the same value and purpose.
Developers must be aware that this variable affects the behavior of joint constraints in physics simulations. It determines when restitution (bounciness) is applied to angular movements in joints. If the initial angular velocity is below this threshold, no restitution is applied, potentially reducing computational overhead for minor movements.
Best practices when using this variable include:
- Adjusting it based on the scale and requirements of your physics simulations.
- Testing different values to find the right balance between performance and realistic joint behavior.
- Considering its impact on both visual fidelity and performance, especially in physics-heavy scenes.
Regarding the associated variable Chaos_Joint_AngularVelocityThresholdToApplyRestitution:
- Its purpose is identical to p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution.
- It’s used directly in the Chaos physics code to perform the threshold check.
- It’s defined in the same file and set to the same default value.
- The best practices and considerations are the same as for the console variable version.
This variable is crucial for fine-tuning the behavior of joint physics in the Chaos system, allowing developers to optimize performance while maintaining realistic physical interactions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/JointConstraintsCVars.cpp:23
Scope: file
Source code excerpt:
float Chaos_Joint_AngularVelocityThresholdToApplyRestitution = 1e-2f;
FAutoConsoleVariableRef CVarChaosJointAngularVelocityThresholdToApplyRestitution(TEXT("p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution"), Chaos_Joint_AngularVelocityThresholdToApplyRestitution, TEXT("Apply restitution only if initial velocity is higher than this threshold (used in Quasipbd)"));
#Associated Variable and Callsites
This variable is associated with another variable named Chaos_Joint_AngularVelocityThresholdToApplyRestitution
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/JointConstraintsCVars.cpp:22
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarChaosJointLinearVelocityThresholdToApplyRestitution(TEXT("p.Chaos.Joint.LinearVelocityThresholdToApplyRestitution"), Chaos_Joint_LinearVelocityThresholdToApplyRestitution, TEXT("Apply restitution only if initial velocity is higher than this threshold (used in Quasipbd)"));
float Chaos_Joint_AngularVelocityThresholdToApplyRestitution = 1e-2f;
FAutoConsoleVariableRef CVarChaosJointAngularVelocityThresholdToApplyRestitution(TEXT("p.Chaos.Joint.AngularVelocityThresholdToApplyRestitution"), Chaos_Joint_AngularVelocityThresholdToApplyRestitution, TEXT("Apply restitution only if initial velocity is higher than this threshold (used in Quasipbd)"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/JointConstraintsCVars.h:26
Scope: file
Source code excerpt:
extern float Chaos_Joint_LinearVelocityThresholdToApplyRestitution;
extern float Chaos_Joint_AngularVelocityThresholdToApplyRestitution;
extern bool bChaos_Joint_UseCachedSolver;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointCachedSolverGaussSeidel.cpp:1275
Scope (from outer to inner):
file
namespace Chaos
function void FPBDJointCachedSolver::ApplyAngularVelocityConstraint
Source code excerpt:
{
const FReal InitVel = InitConstraintAxisAngularVelocities[ConstraintIndex];
TargetVel = InitVel > Chaos_Joint_AngularVelocityThresholdToApplyRestitution ?
-RotationConstraints.ConstraintRestitution[ConstraintIndex] * InitVel : 0.0f;
}
SolveAngularVelocityConstraint(ConstraintIndex, TargetVel);
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointSolverGaussSeidel.cpp:949
Scope (from outer to inner):
file
namespace Chaos
function void FPBDJointSolver::ApplyTwistVelocityConstraint
Source code excerpt:
{
const FReal InitVel = InitConstraintAxisAngularVelocities[(int32)EJointAngularConstraintIndex::Twist];
TargetVel = InitVel > Chaos_Joint_AngularVelocityThresholdToApplyRestitution ? -JointSettings.TwistRestitution * InitVel : 0.0f;
}
ApplyAngularVelocityConstraint(TwistStiffness, TwistAxis, TargetVel);
}
}
void FPBDJointSolver::ApplyConeVelocityConstraint(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointSolverGaussSeidel.cpp:976
Scope (from outer to inner):
file
namespace Chaos
function void FPBDJointSolver::ApplyConeVelocityConstraint
Source code excerpt:
{
const FReal InitVel = InitConstraintAxisAngularVelocities[(int32)EJointAngularConstraintIndex::Swing1];
TargetVel = InitVel > Chaos_Joint_AngularVelocityThresholdToApplyRestitution ? -JointSettings.SwingRestitution * InitVel : 0.0f;
}
ApplyAngularVelocityConstraint(SwingStiffness, SwingAxis, TargetVel);
}
}
void FPBDJointSolver::ApplySingleLockedSwingVelocityConstraint(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointSolverGaussSeidel.cpp:1020
Scope (from outer to inner):
file
namespace Chaos
function void FPBDJointSolver::ApplyDualConeSwingVelocityConstraint
Source code excerpt:
{
const FReal InitVel = InitConstraintAxisAngularVelocities[(int32)SwingConstraintIndex];
TargetVel = InitVel > Chaos_Joint_AngularVelocityThresholdToApplyRestitution ? -JointSettings.SwingRestitution * InitVel : 0.0f;
}
ApplyAngularVelocityConstraint(SwingStiffness, SwingAxis, TargetVel);
}
}
void FPBDJointSolver::ApplySwingVelocityConstraint(
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointSolverGaussSeidel.cpp:1044
Scope (from outer to inner):
file
namespace Chaos
function void FPBDJointSolver::ApplySwingVelocityConstraint
Source code excerpt:
{
const FReal InitVel = InitConstraintAxisAngularVelocities[(int32)SwingConstraintIndex];
TargetVel = InitVel > Chaos_Joint_AngularVelocityThresholdToApplyRestitution ? -JointSettings.SwingRestitution * InitVel : 0.0f;
}
ApplyAngularVelocityConstraint(SwingStiffness, SwingAxis, TargetVel);
}
}
void FPBDJointSolver::ApplyAngularVelocityConstraint(