p.Chaos.Solver.Collision.UseManifolds

p.Chaos.Solver.Collision.UseManifolds

#Overview

name: p.Chaos.Solver.Collision.UseManifolds

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.UseManifolds is to control the use of manifolds in collision detection within the Chaos physics system of Unreal Engine 5. Manifolds are used to represent contact regions between colliding objects, which can improve the accuracy and efficiency of collision resolution.

This setting variable is primarily used in the Chaos physics subsystem, specifically within the PBDRigidsSolver module. The Chaos namespace suggests that this is part of the experimental Chaos physics engine in Unreal Engine 5.

The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It is initialized with a default value of 1, enabling the use of manifolds by default.

The associated variable ChaosSolverCollisionUseManifolds directly interacts with p.Chaos.Solver.Collision.UseManifolds. They share the same value, with ChaosSolverCollisionUseManifolds being the actual int32 variable used in the code.

Developers should be aware that this variable affects the collision detection behavior in the Chaos physics system. Enabling or disabling manifolds can impact both the performance and accuracy of collision detection.

Best practices when using this variable include:

  1. Testing the impact on performance and collision accuracy when enabling or disabling manifolds.
  2. Considering the types of objects and scenarios in your game that might benefit from manifold-based collision detection.
  3. Using this in conjunction with other Chaos physics settings for optimal results.

Regarding the associated variable ChaosSolverCollisionUseManifolds:

The purpose of ChaosSolverCollisionUseManifolds is to store the actual value of the p.Chaos.Solver.Collision.UseManifolds setting within the C++ code.

This variable is used directly in the Chaos physics subsystem, specifically in the PrepareAdvanceBy function of the FPBDRigidsSolver class.

The value of this variable is set through the CVar system and can be modified at runtime.

It interacts directly with the CollisionDetectorSettings.bAllowManifolds flag, determining whether manifolds are allowed in the collision detection process.

Developers should be aware that changes to this variable will directly affect the behavior of the collision detection system in the Chaos physics engine.

Best practices include:

  1. Monitoring the performance impact of enabling or disabling manifolds in your specific use case.
  2. Considering the trade-offs between collision accuracy and computational cost when adjusting this setting.
  3. Testing thoroughly with different object types and scenarios to ensure desired behavior across your game.

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		// Allow one-shot or incremental manifolds where supported (which depends on shape pair types)
		int32 ChaosSolverCollisionUseManifolds = 1;
		FAutoConsoleVariableRef CVarChaosSolverCollisionUseManifolds(TEXT("p.Chaos.Solver.Collision.UseManifolds"), ChaosSolverCollisionUseManifolds, TEXT("Enable/Disable use of manifolds in collision."));

		// Allow manifolds to be reused between ticks
		int32 ChaosSolverCollisionAllowManifoldUpdate = 1;
		FAutoConsoleVariableRef CVarChaosSolverCollisionAllowManifoldUpdate(TEXT("p.Chaos.Solver.Collision.AllowManifoldUpdate"), ChaosSolverCollisionAllowManifoldUpdate, TEXT("Enable/Disable reuse of manifolds between ticks (for small movement)."));

		// Enable/Disable CCD. Set to false to disable the system, regardless of particle settings

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		// Allow one-shot or incremental manifolds where supported (which depends on shape pair types)
		int32 ChaosSolverCollisionUseManifolds = 1;
		FAutoConsoleVariableRef CVarChaosSolverCollisionUseManifolds(TEXT("p.Chaos.Solver.Collision.UseManifolds"), ChaosSolverCollisionUseManifolds, TEXT("Enable/Disable use of manifolds in collision."));

		// Allow manifolds to be reused between ticks
		int32 ChaosSolverCollisionAllowManifoldUpdate = 1;
		FAutoConsoleVariableRef CVarChaosSolverCollisionAllowManifoldUpdate(TEXT("p.Chaos.Solver.Collision.AllowManifoldUpdate"), ChaosSolverCollisionAllowManifoldUpdate, TEXT("Enable/Disable reuse of manifolds between ticks (for small movement)."));

		// Enable/Disable CCD. Set to false to disable the system, regardless of particle settings

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

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsSolver::PrepareAdvanceBy

Source code excerpt:

		CollisionDetectorSettings.bAllowManifoldReuse = (ChaosSolverCollisionAllowManifoldUpdate != 0);
		CollisionDetectorSettings.bDeferNarrowPhase = (ChaosSolverCollisionDeferNarrowPhase != 0);
		CollisionDetectorSettings.bAllowManifolds = (ChaosSolverCollisionUseManifolds != 0);
		CollisionDetectorSettings.bAllowCCD = bChaosUseCCD;
		CollisionDetectorSettings.bAllowMACD = bChaosUseMACD;
		MEvolution->GetCollisionConstraints().SetDetectorSettings(CollisionDetectorSettings);
		
		FPBDJointSolverSettings JointsSettings = MEvolution->GetJointConstraints().GetSettings();
		JointsSettings.MinSolverStiffness = ChaosSolverJointMinSolverStiffness;