p.Chaos.Solver.DoFinalProbeNarrowPhase

p.Chaos.Solver.DoFinalProbeNarrowPhase

#Overview

name: p.Chaos.Solver.DoFinalProbeNarrowPhase

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.DoFinalProbeNarrowPhase is to control whether a final probe narrow phase collision detection is performed in the Chaos physics solver. This setting is part of the Chaos physics system in Unreal Engine 5, which is responsible for simulating physical interactions between objects in the game world.

This setting variable is primarily used in the Chaos module, specifically within the PBDRigidsEvolutionGBF (Position Based Dynamics Rigid Evolution Game-Based Force) component of the solver. It’s part of the collision detection system, which is crucial for accurate physics simulations.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands. By default, it’s set to true.

The associated variable DoFinalProbeNarrowPhase directly interacts with p.Chaos.Solver.DoFinalProbeNarrowPhase. They share the same value and are used interchangeably in the code.

Developers should be aware that enabling this feature (which is the default behavior) will cause the solver to perform an additional narrow phase collision detection step at the end of each physics update. This can improve the accuracy of collision detection, especially for fast-moving objects or in scenarios where objects might have moved significantly during a single time step.

Best practices when using this variable include:

  1. Keep it enabled (true) for most scenarios to ensure accurate collision detection.
  2. Consider disabling it only if performance is a critical issue and you’re certain that the final probe is not necessary for your specific use case.
  3. If you disable it, thoroughly test your physics simulations to ensure that no unintended collision misses occur.

Regarding the associated variable DoFinalProbeNarrowPhase:

The purpose of DoFinalProbeNarrowPhase is the same as p.Chaos.Solver.DoFinalProbeNarrowPhase. It’s the actual boolean variable that controls the behavior within the code.

This variable is used directly in the AdvanceOneTimeStepImpl function of the FPBDRigidsEvolutionGBF class. When true, it triggers the DetectProbeCollisions function on the collision constraints after particles have been moved to their new locations.

The value of this variable is set through the console variable p.Chaos.Solver.DoFinalProbeNarrowPhase.

Developers should be aware that this variable directly affects the physics simulation loop. Changing its value will immediately impact how collisions are detected and resolved in the next physics update.

Best practices for using DoFinalProbeNarrowPhase are the same as those for p.Chaos.Solver.DoFinalProbeNarrowPhase, as they are essentially the same setting, just accessed in different ways within the codebase.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:98

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		bool DoFinalProbeNarrowPhase = true;
		FAutoConsoleVariableRef CVarDoFinalProbeNarrowPhase(TEXT("p.Chaos.Solver.DoFinalProbeNarrowPhase"), DoFinalProbeNarrowPhase, TEXT(""));

		// Enable inertia conditioning for joint and collisions stabilization for small and thin objects
		bool bChaosSolverInertiaConditioningEnabled = true;
		FAutoConsoleVariableRef  CVarChaosSolverInertiaConditioningEnabled(TEXT("p.Chaos.Solver.InertiaConditioning.Enabled"), bChaosSolverInertiaConditioningEnabled, TEXT("Enable/Disable constraint stabilization through inertia conditioning"));

		// The largest joint error we expect to resolve in a moderately stable way

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:97

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarTransferCollisionsDebugTestAgainstMaxClamp(TEXT("p.Chaos.Solver.Joint.TransferCollisionsDebugTestAgainstMaxClamp"), TransferCollisionsDebugTestAgainstMaxClamp, TEXT("Force all joint collision constraint settings to max clamp value to validate stability [def:false]"));

		bool DoFinalProbeNarrowPhase = true;
		FAutoConsoleVariableRef CVarDoFinalProbeNarrowPhase(TEXT("p.Chaos.Solver.DoFinalProbeNarrowPhase"), DoFinalProbeNarrowPhase, TEXT(""));

		// Enable inertia conditioning for joint and collisions stabilization for small and thin objects
		bool bChaosSolverInertiaConditioningEnabled = true;
		FAutoConsoleVariableRef  CVarChaosSolverInertiaConditioningEnabled(TEXT("p.Chaos.Solver.InertiaConditioning.Enabled"), bChaosSolverInertiaConditioningEnabled, TEXT("Enable/Disable constraint stabilization through inertia conditioning"));

		// The largest joint error we expect to resolve in a moderately stable way

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:708

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsEvolutionGBF::AdvanceOneTimeStepImpl

Source code excerpt:

#endif

	if (CVars::DoFinalProbeNarrowPhase)
	{
		// Run contact updates on probe constraints
		// NOTE: This happens after particles have been moved to their new locations
		// so that we get contacts that are correct for end-of-frame positions
		GetCollisionConstraints().DetectProbeCollisions(Dt);
	}