p.Chaos.Solver.Sleep.IsolatedParticle.CounterMultiplier

p.Chaos.Solver.Sleep.IsolatedParticle.CounterMultiplier

#Overview

name: p.Chaos.Solver.Sleep.IsolatedParticle.CounterMultiplier

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.Sleep.IsolatedParticle.CounterMultiplier is to adjust the sleep counter threshold for isolated (floating) particles in the Chaos physics system of Unreal Engine 5. This setting variable is specifically for the physics simulation system, particularly for managing the sleep state of isolated particles.

This setting variable is primarily used in the Chaos physics module, which is part of Unreal Engine’s experimental physics system. Based on the callsites, it’s used within the IslandManager.cpp file, which suggests it’s involved in managing physics islands - groups of interacting physics objects.

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

This variable interacts closely with two other variables: IsolatedParticleSleepLinearThresholdMultiplier and IsolatedParticleSleepAngularThresholdMultiplier. Together, these three variables control different aspects of when an isolated particle should enter a sleep state.

Developers must be aware that this variable specifically affects isolated or floating particles. Increasing this value will make it harder for these particles to enter a sleep state, which can impact performance and simulation accuracy.

Best practices when using this variable include:

  1. Only modify it if you’re experiencing issues with isolated particles incorrectly entering sleep states.
  2. Balance it with the linear and angular threshold multipliers for consistent behavior.
  3. Monitor performance impact when adjusting this value, as it can affect simulation efficiency.

Regarding the associated variable IsolatedParticleSleepCounterThresholdMultiplier:

The purpose of this variable is the same as p.Chaos.Solver.Sleep.IsolatedParticle.CounterMultiplier, as they are directly linked.

It’s used in the GetIsolatedParticleSleepThresholds function to modify the sleep counter threshold for isolated particles. This function is likely called when determining if a particle should enter a sleep state.

The value is set to 1 by default and is modified through the CVar system, just like the main variable.

It interacts directly with the main variable and is used in conjunction with the linear and angular threshold multipliers.

Developers should be aware that this variable directly affects the behavior of isolated particles in the physics simulation. Increasing it will make particles less likely to sleep, potentially improving accuracy but at the cost of performance.

Best practices include carefully tuning this value in conjunction with other sleep-related variables to achieve the desired balance between simulation accuracy and performance for your specific use case.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Island/IslandManager.cpp:70

Scope (from outer to inner):

file
namespace    Chaos::CVars

Source code excerpt:

	/* Cvar to increase the sleep counter threshold for floating particles */
	int32 IsolatedParticleSleepCounterThresholdMultiplier = 1;
	FAutoConsoleVariableRef CVarChaosSolverIsolatedParticleSleepCounterThresholdMultiplier(TEXT("p.Chaos.Solver.Sleep.IsolatedParticle.CounterMultiplier"), IsolatedParticleSleepCounterThresholdMultiplier, TEXT("A multiplier applied to SleepCounterThreshold for floating particles"));

	/* Cvar to adjust the sleep linear threshold for floating particles */
	FRealSingle IsolatedParticleSleepLinearThresholdMultiplier = 1.0f;
	FAutoConsoleVariableRef CVarChaosSolverIsolatedParticleSleepLinearThresholdMultiplier(TEXT("p.Chaos.Solver.Sleep.IsolatedParticle.LinearMultiplier"), IsolatedParticleSleepLinearThresholdMultiplier, TEXT("A multiplier applied to SleepLinearThreshold for floating particles"));

	/* Cvar to adjust the sleep angular threshold for floating particles */

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Island/IslandManager.cpp:69

Scope (from outer to inner):

file
namespace    Chaos::CVars

Source code excerpt:


	/* Cvar to increase the sleep counter threshold for floating particles */
	int32 IsolatedParticleSleepCounterThresholdMultiplier = 1;
	FAutoConsoleVariableRef CVarChaosSolverIsolatedParticleSleepCounterThresholdMultiplier(TEXT("p.Chaos.Solver.Sleep.IsolatedParticle.CounterMultiplier"), IsolatedParticleSleepCounterThresholdMultiplier, TEXT("A multiplier applied to SleepCounterThreshold for floating particles"));

	/* Cvar to adjust the sleep linear threshold for floating particles */
	FRealSingle IsolatedParticleSleepLinearThresholdMultiplier = 1.0f;
	FAutoConsoleVariableRef CVarChaosSolverIsolatedParticleSleepLinearThresholdMultiplier(TEXT("p.Chaos.Solver.Sleep.IsolatedParticle.LinearMultiplier"), IsolatedParticleSleepLinearThresholdMultiplier, TEXT("A multiplier applied to SleepLinearThreshold for floating particles"));

	/* Cvar to adjust the sleep angular threshold for floating particles */

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Island/IslandManager.cpp:210

Scope (from outer to inner):

file
namespace    Chaos::Private
function     bool GetIsolatedParticleSleepThresholds

Source code excerpt:

			// so we scale the thesholds to make sleeping harder. E.g., to avoid going to sleep at the apex of an
			// upwards ballistic trajectory, or when a floating oscillating body reverses rotation, etc.
			OutSleepCounterThreshold *= FMath::Max(1, CVars::IsolatedParticleSleepCounterThresholdMultiplier);
			OutSleepLinearThreshold *= FMath::Max(0.0f, CVars::IsolatedParticleSleepLinearThresholdMultiplier);
			OutSleepAngularThreshold *= FMath::Max(0.0f, CVars::IsolatedParticleSleepAngularThresholdMultiplier);

			return true;
		}