p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio1

p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio1

#Overview

name: p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio1

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.PBDCollisionSolver.AutoStiffness.MassRatio1 is to control the stiffness of the Position Based Dynamics (PBD) collision solver in Unreal Engine’s Chaos physics system. This setting variable is specifically used to define a mass ratio threshold at which the solver stiffness will be equal to 1.

This setting variable is primarily used by the Chaos physics system, which is an experimental physics engine in Unreal Engine 5. It’s part of the collision solving mechanism, specifically the PBD (Position Based Dynamics) collision solver.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.

This variable interacts closely with another variable, p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio2. Together, these two variables define a range for automatic stiffness calculation based on mass ratios. When the mass ratio equals MassRatio1, the solver stiffness will be 1, and when it equals MassRatio2, the stiffness will be 0.

Developers must be aware that this variable is part of an experimental physics system. Its behavior may change in future engine versions, and it might not be suitable for all production environments without thorough testing.

Best practices when using this variable include:

  1. Always test thoroughly after modifying this value, as it can significantly impact collision behavior.
  2. Consider the relationship between this variable and MassRatio2 when making adjustments.
  3. Monitor performance impacts, as changes to solver stiffness can affect computational load.

The associated variable Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1 is the internal representation of the console variable. It’s used directly in the physics calculations within the Chaos system. This variable is declared in the Chaos::CVars namespace and is used in conjunction with the console variable system to allow runtime modifications of the physics behavior.

When working with Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1, developers should:

  1. Be cautious about directly modifying this variable in code, as it’s intended to be controlled via the console variable system.
  2. Understand that changes to this variable will immediately affect the physics simulation.
  3. Consider adding logging or debugging features when experimenting with different values to better understand the impact on the simulation.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:32

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FRealSingle Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1 = 0;
		FRealSingle Chaos_PBDCollisionSolver_AutoStiffness_MassRatio2 = 0;
		FAutoConsoleVariableRef CVarChaosPBDCollisionSolverAutoStiffnessMassRatio1(TEXT("p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio1"), Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1, TEXT(""));
		FAutoConsoleVariableRef CVarChaosPBDCollisionSolverAutoStiffnessMassRatio2(TEXT("p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio2"), Chaos_PBDCollisionSolver_AutoStiffness_MassRatio2, TEXT(""));

		// Jacobi solver stiffness
		// @todo(chaos): to be tuned
		FRealSingle Chaos_PBDCollisionSolver_JacobiStiffness = 0.5f;
		FAutoConsoleVariableRef CVarChaosPBDCollisionSolverJacobiStiffness(TEXT("p.Chaos.PBDCollisionSolver.JacobiStiffness"), Chaos_PBDCollisionSolver_JacobiStiffness, TEXT(""));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolver.cpp:30

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		// Solver stiffness will be equal to 1 when the mass ratio is MassRatio1.
		// Solver stiffness will be equal to 0 when the mass ratio is MassRatio2.
		FRealSingle Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1 = 0;
		FRealSingle Chaos_PBDCollisionSolver_AutoStiffness_MassRatio2 = 0;
		FAutoConsoleVariableRef CVarChaosPBDCollisionSolverAutoStiffnessMassRatio1(TEXT("p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio1"), Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1, TEXT(""));
		FAutoConsoleVariableRef CVarChaosPBDCollisionSolverAutoStiffnessMassRatio2(TEXT("p.Chaos.PBDCollisionSolver.AutoStiffness.MassRatio2"), Chaos_PBDCollisionSolver_AutoStiffness_MassRatio2, TEXT(""));

		// Jacobi solver stiffness
		// @todo(chaos): to be tuned
		FRealSingle Chaos_PBDCollisionSolver_JacobiStiffness = 0.5f;
		FAutoConsoleVariableRef CVarChaosPBDCollisionSolverJacobiStiffness(TEXT("p.Chaos.PBDCollisionSolver.JacobiStiffness"), Chaos_PBDCollisionSolver_JacobiStiffness, TEXT(""));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Collision/PBDCollisionContainerSolverJacobi.cpp:25

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		extern bool bChaos_PBDCollisionSolver_Velocity_SolveEnabled;

		extern FRealSingle Chaos_PBDCollisionSolver_AutoStiffness_MassRatio1;
		extern FRealSingle Chaos_PBDCollisionSolver_AutoStiffness_MassRatio2;

		extern FRealSingle Chaos_PBDCollisionSolver_JacobiStiffness;
	}

	namespace Private