p.Chaos.Solver.Joint.ShockPropagation

p.Chaos.Solver.Joint.ShockPropagation

#Overview

name: p.Chaos.Solver.Joint.ShockPropagation

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Solver.Joint.ShockPropagation is to control the shock propagation behavior in the 6DoF (six degrees of freedom) joints within the Chaos physics solver of Unreal Engine 5. This setting variable is part of the physics simulation system, specifically for joint dynamics.

This setting variable is primarily used in the Chaos physics solver, which is part of the Experimental Chaos module in Unreal Engine 5. Based on the callsites, it’s clear that this variable is utilized within the PBDRigidsSolver (Position Based Dynamics Rigid Solver) component of the Chaos system.

The value of this variable is set through a console variable (CVAR) system, as evident from the FAutoConsoleVariableRef usage. This allows for runtime modification of the value, which can be useful for debugging and fine-tuning physics behavior.

The associated variable ChaosSolverJointShockPropagation interacts directly with p.Chaos.Solver.Joint.ShockPropagation. They share the same value, with ChaosSolverJointShockPropagation being the actual variable used in the solver’s logic.

Developers must be aware that this variable is a float value, and its default setting is -1.0f. The comment suggests that the shock propagation override is only applied if the value is greater than or equal to 0, implying that negative values disable this feature.

Best practices when using this variable include:

  1. Only modify it if you understand the implications on joint physics behavior.
  2. Use it in conjunction with other joint-related settings for comprehensive control over joint dynamics.
  3. Consider using it for debug purposes or fine-tuning physics behavior in specific scenarios.

Regarding the associated variable ChaosSolverJointShockPropagation:

#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:398

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		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"));


		// Enable a couple bug fixes with temporary roll-back just in case

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:391

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		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"));


		// Enable a couple bug fixes with temporary roll-back just in case

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1302

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PrepareAdvanceBy

Source code excerpt:

		JointsSettings.bUsePositionBasedDrives = bChaosSolverJointUsePositionBasedDrives;
		JointsSettings.NumShockPropagationIterations = ChaosSolverJointNumShockProagationIterations;
		JointsSettings.ShockPropagationOverride = ChaosSolverJointShockPropagation;
		JointsSettings.bUseLinearSolver = bChaosSolverJointUseLinearSolver;
		JointsSettings.bSortEnabled = false;
		MEvolution->GetJointConstraints().SetSettings(JointsSettings);

		// Apply CVAR overrides if set
		{