p.Chaos.Solver.Collision.DepenetrationVelocity

p.Chaos.Solver.Collision.DepenetrationVelocity

#Overview

name: p.Chaos.Solver.Collision.DepenetrationVelocity

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.Collision.DepenetrationVelocity is to control the initial overlap depenetration velocity in the Chaos physics solver, which is part of Unreal Engine’s physics simulation system.

This setting variable is primarily used by the Chaos physics module, specifically within the PBDRigidsSolver (Position Based Dynamics Rigid Solver) component. It’s part of the collision handling system in the Chaos physics engine.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of -1.0f and can be overridden at runtime using the console command system.

This variable interacts closely with another variable named ChaosSolverDepenetrationVelocity. They share the same value, and ChaosSolverDepenetrationVelocity is used to actually apply the setting within the solver.

Developers must be aware that this variable only takes effect if its value is greater than or equal to 0. If it’s set to a negative value, it won’t override the default behavior of the physics solver.

Best practices when using this variable include:

  1. Only modify it if you need to fine-tune the collision behavior of your physics simulation.
  2. Test thoroughly after changing this value, as it can significantly impact the behavior of physics objects in your game.
  3. Consider exposing this as a tweakable parameter in your game’s debug or settings menu for easier tuning during development.

Regarding the associated variable ChaosSolverDepenetrationVelocity:

The purpose of ChaosSolverDepenetrationVelocity is to store and apply the depenetration velocity value within the Chaos solver.

It’s used directly in the FPBDRigidsSolver::PrepareAdvanceBy function to set the collision depenetration velocity if its value is greater than or equal to 0.

The value of this variable is set by the console variable system, mirroring the value of p.Chaos.Solver.Collision.DepenetrationVelocity.

This variable interacts directly with the SetCollisionDepenetrationVelocity function of the physics solver.

Developers should be aware that this variable is the actual implementation variable used by the solver, while p.Chaos.Solver.Collision.DepenetrationVelocity is the exposed console variable for user configuration.

Best practices for this variable are similar to those for p.Chaos.Solver.Collision.DepenetrationVelocity, as they are tightly coupled. Any changes to one should consider the impact on the other.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		FRealSingle ChaosSolverDepenetrationVelocity = -1.0f;
		FAutoConsoleVariableRef CVarChaosSolverInitialOverlapDepentrationVelocity(TEXT("p.Chaos.Solver.Collision.DepenetrationVelocity"), ChaosSolverDepenetrationVelocity, TEXT("Override initial overlap depenetration velocity (if >= 0)"), OnCollisionConfigCVarChanged);

		int32 ChaosSolverCleanupCommandsOnDestruction = 1;
		FAutoConsoleVariableRef CVarChaosSolverCleanupCommandsOnDestruction(TEXT("p.Chaos.Solver.CleanupCommandsOnDestruction"), ChaosSolverCleanupCommandsOnDestruction, TEXT("Whether or not to run internal command queue cleanup on solver destruction (0 = no cleanup, >0 = cleanup all commands)"));

		int32 ChaosSolverCollisionDeferNarrowPhase = 0;
		FAutoConsoleVariableRef CVarChaosSolverCollisionDeferNarrowPhase(TEXT("p.Chaos.Solver.Collision.DeferNarrowPhase"), ChaosSolverCollisionDeferNarrowPhase, TEXT("Create contacts for all broadphase pairs, perform NarrowPhase later."));

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverMaxPushOutVelocity(TEXT("p.Chaos.Solver.Collision.MaxPushOutVelocity"), ChaosSolverMaxPushOutVelocity, TEXT("Override max pushout velocity (if >= 0)"), OnCollisionConfigCVarChanged);

		FRealSingle ChaosSolverDepenetrationVelocity = -1.0f;
		FAutoConsoleVariableRef CVarChaosSolverInitialOverlapDepentrationVelocity(TEXT("p.Chaos.Solver.Collision.DepenetrationVelocity"), ChaosSolverDepenetrationVelocity, TEXT("Override initial overlap depenetration velocity (if >= 0)"), OnCollisionConfigCVarChanged);

		int32 ChaosSolverCleanupCommandsOnDestruction = 1;
		FAutoConsoleVariableRef CVarChaosSolverCleanupCommandsOnDestruction(TEXT("p.Chaos.Solver.CleanupCommandsOnDestruction"), ChaosSolverCleanupCommandsOnDestruction, TEXT("Whether or not to run internal command queue cleanup on solver destruction (0 = no cleanup, >0 = cleanup all commands)"));

		int32 ChaosSolverCollisionDeferNarrowPhase = 0;
		FAutoConsoleVariableRef CVarChaosSolverCollisionDeferNarrowPhase(TEXT("p.Chaos.Solver.Collision.DeferNarrowPhase"), ChaosSolverCollisionDeferNarrowPhase, TEXT("Create contacts for all broadphase pairs, perform NarrowPhase later."));

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PrepareAdvanceBy

Source code excerpt:

				SetCollisionMaxPushOutVelocity(ChaosSolverMaxPushOutVelocity);
			}
			if (ChaosSolverDepenetrationVelocity >= 0.0f)
			{
				SetCollisionDepenetrationVelocity(ChaosSolverDepenetrationVelocity);
			}
			if (ChaosSolverDeterministic >= 0)
			{
				UpdateIsDeterministic();
			}
		}