p.Chaos.Solver.Joint.UsePBDDrives
p.Chaos.Solver.Joint.UsePBDDrives
#Overview
name: p.Chaos.Solver.Joint.UsePBDDrives
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to solve drives in the position or velocity phase of the solver (default true
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Joint.UsePBDDrives is to control whether the Chaos physics solver uses Position-Based Dynamics (PBD) drives for joint constraints in the position or velocity phase of the solver.
This setting variable is primarily used in the Chaos physics system, which is part of Unreal Engine’s experimental physics simulation module. It affects the behavior of joint constraints in rigid body simulations.
The value of this variable is set through the Unreal Engine’s console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files.
This variable interacts closely with the bChaosSolverJointUsePositionBasedDrives variable. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the solving method for joint drives. When set to true (default), it uses Position-Based Dynamics in the position phase of the solver. When false, it likely uses a velocity-based approach in the velocity phase.
Best practices when using this variable include:
- Understanding the implications on physics simulation performance and stability.
- Testing thoroughly when changing from the default value, as it may significantly affect joint behavior.
- Considering the interaction with other joint-related settings in the Chaos solver.
Regarding the associated variable bChaosSolverJointUsePositionBasedDrives:
The purpose of bChaosSolverJointUsePositionBasedDrives is identical to p.Chaos.Solver.Joint.UsePBDDrives. It’s an internal boolean variable that directly controls the behavior set by the console variable.
This variable is used within the Chaos physics system, specifically in the PBDRigidsSolver class, which is responsible for solving rigid body dynamics.
The value of this variable is set based on the console variable p.Chaos.Solver.Joint.UsePBDDrives.
It interacts directly with the JointsSettings structure in the PrepareAdvanceBy function of the FPBDRigidsSolver class, affecting how joint constraints are solved.
Developers should be aware that this variable directly influences the solver’s behavior and should be consistent with the console variable setting.
Best practices include ensuring that any code that needs to check this setting uses the bChaosSolverJointUsePositionBasedDrives variable rather than directly accessing the console variable, for consistency and performance reasons.
#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:396
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverJointNumIterationsAtMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.NumIterationsAtMaxSolverStiffness"), ChaosSolverJointNumIterationsAtMaxSolverStiffness, TEXT("How many iterations we want at MaxSolverStiffness."));
FAutoConsoleVariableRef CVarChaosSolverJointSolvePositionFirst(TEXT("p.Chaos.Solver.Joint.SolvePositionLast"), bChaosSolverJointSolvePositionLast, TEXT("Should we solve joints in position-then-rotation order (false) or rotation-then-position order (true, default)"));
FAutoConsoleVariableRef CVarChaosSolverJointUsePBDVelocityDrives(TEXT("p.Chaos.Solver.Joint.UsePBDDrives"), bChaosSolverJointUsePositionBasedDrives, TEXT("Whether to solve drives in the position or velocity phase of the solver (default true"));
FAutoConsoleVariableRef CVarChaosSolverJointNumShockPropagationIterations(TEXT("p.Chaos.Solver.Joint.NumShockPropagationIterations"), ChaosSolverJointNumShockProagationIterations, TEXT("How many iterations to enable SHockProagation for."));
FAutoConsoleVariableRef CVarChaosSolverJointShockPropagation(TEXT("p.Chaos.Solver.Joint.ShockPropagation"), ChaosSolverJointShockPropagation, TEXT("6Dof joint shock propagation override (if >= 0)."));
int32 ChaosVisualDebuggerEnable = 1;
FAutoConsoleVariableRef CVarChaosVisualDebuggerEnable(TEXT("p.Chaos.VisualDebuggerEnable"), ChaosVisualDebuggerEnable, TEXT("Enable/Disable pushing/saving data to the visual debugger"));
#Associated Variable and Callsites
This variable is associated with another variable named bChaosSolverJointUsePositionBasedDrives
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:389
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverJointNumIterationsAtMaxSolverStiffness = 1;
bool bChaosSolverJointSolvePositionLast = true;
bool bChaosSolverJointUsePositionBasedDrives = true;
int32 ChaosSolverJointNumShockProagationIterations = 0;
FRealSingle ChaosSolverJointShockPropagation = -1.0f;
FAutoConsoleVariableRef CVarChaosSolverJointMinSolverStiffness(TEXT("p.Chaos.Solver.Joint.MinSolverStiffness"), ChaosSolverJointMinSolverStiffness, TEXT("Solver stiffness on first iteration, increases each iteration toward MaxSolverStiffness."));
FAutoConsoleVariableRef CVarChaosSolverJointMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.MaxSolverStiffness"), ChaosSolverJointMaxSolverStiffness, TEXT("Solver stiffness on last iteration, increases each iteration from MinSolverStiffness."));
FAutoConsoleVariableRef CVarChaosSolverJointNumIterationsAtMaxSolverStiffness(TEXT("p.Chaos.Solver.Joint.NumIterationsAtMaxSolverStiffness"), ChaosSolverJointNumIterationsAtMaxSolverStiffness, TEXT("How many iterations we want at MaxSolverStiffness."));
FAutoConsoleVariableRef CVarChaosSolverJointSolvePositionFirst(TEXT("p.Chaos.Solver.Joint.SolvePositionLast"), bChaosSolverJointSolvePositionLast, TEXT("Should we solve joints in position-then-rotation order (false) or rotation-then-position order (true, default)"));
FAutoConsoleVariableRef CVarChaosSolverJointUsePBDVelocityDrives(TEXT("p.Chaos.Solver.Joint.UsePBDDrives"), bChaosSolverJointUsePositionBasedDrives, TEXT("Whether to solve drives in the position or velocity phase of the solver (default true"));
FAutoConsoleVariableRef CVarChaosSolverJointNumShockPropagationIterations(TEXT("p.Chaos.Solver.Joint.NumShockPropagationIterations"), ChaosSolverJointNumShockProagationIterations, TEXT("How many iterations to enable SHockProagation for."));
FAutoConsoleVariableRef CVarChaosSolverJointShockPropagation(TEXT("p.Chaos.Solver.Joint.ShockPropagation"), ChaosSolverJointShockPropagation, TEXT("6Dof joint shock propagation override (if >= 0)."));
int32 ChaosVisualDebuggerEnable = 1;
FAutoConsoleVariableRef CVarChaosVisualDebuggerEnable(TEXT("p.Chaos.VisualDebuggerEnable"), ChaosVisualDebuggerEnable, TEXT("Enable/Disable pushing/saving data to the visual debugger"));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1300
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
JointsSettings.MaxInertiaRatio = ChaosSolverJointMaxInertiaRatio;
JointsSettings.bSolvePositionLast = bChaosSolverJointSolvePositionLast;
JointsSettings.bUsePositionBasedDrives = bChaosSolverJointUsePositionBasedDrives;
JointsSettings.NumShockPropagationIterations = ChaosSolverJointNumShockProagationIterations;
JointsSettings.ShockPropagationOverride = ChaosSolverJointShockPropagation;
JointsSettings.bUseLinearSolver = bChaosSolverJointUseLinearSolver;
JointsSettings.bSortEnabled = false;
MEvolution->GetJointConstraints().SetSettings(JointsSettings);