MinPhysicsDeltaTime

MinPhysicsDeltaTime

#Overview

name: MinPhysicsDeltaTime

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MinPhysicsDeltaTime is to set a minimum threshold for the physics simulation time step in Unreal Engine 5. It ensures that the physics simulation does not update for extremely small time intervals, which could lead to unnecessary computations and potential instability.

This setting variable is primarily used by the physics engine subsystem within Unreal Engine 5. Based on the callsites, it is part of the PhysicsSettings class, which is likely used across various physics-related modules in the engine.

The value of MinPhysicsDeltaTime is set in the UPhysicsSettings constructor in PhysicsSettings.cpp. It is initialized with a very small default value (UE_SMALL_NUMBER), which allows for fine-grained control over the physics simulation.

MinPhysicsDeltaTime interacts closely with MaxPhysicsDeltaTime, as they together define the acceptable range for physics time steps. It’s also used in conjunction with other physics-related variables like MaxSubstepDeltaTime and MaxSubsteps when setting up the physics scene for each frame.

Developers should be aware that setting MinPhysicsDeltaTime too high might cause the physics simulation to skip updates when the frame rate is very high, potentially leading to less accurate simulations. Conversely, setting it too low might result in unnecessary computational overhead.

Best practices when using this variable include:

  1. Keeping it small enough to ensure smooth physics simulations at high frame rates.
  2. Balancing it with MaxPhysicsDeltaTime to define an appropriate range for physics updates.
  3. Considering the target frame rate and performance requirements of the game when adjusting this value.
  4. Testing thoroughly after making changes, as it can affect the behavior and stability of the physics simulation.
  5. Using it in conjunction with other physics settings to fine-tune the simulation performance and accuracy.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:336, section: [/Script/Engine.PhysicsSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/PhysicsEngine/PhysicsSettings.h:197

Scope (from outer to inner):

file
class        class UPhysicsSettings : public UPhysicsSettingsCore

Source code excerpt:

	/** Min Physics Delta Time; the simulation will not step if the delta time is below this value */
	UPROPERTY(config, EditAnywhere, meta = (ClampMin = "0.0", UIMin = "0.0", ClampMax = "0.0001", UIMax = "0.0001"), Category = Framerate)
	float MinPhysicsDeltaTime;

	/** Max Physics Delta Time to be clamped. */
	UPROPERTY(config, EditAnywhere, meta=(ClampMin="0.0013", UIMin = "0.0013", ClampMax="1.0", UIMax="1.0"), Category=Framerate)
	float MaxPhysicsDeltaTime;

	/** Whether to substep the physics simulation. This feature is still experimental. Certain functionality might not work correctly*/

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/PhysLevel.cpp:146

Scope (from outer to inner):

file
function     void UWorld::SetupPhysicsTickFunctions

Source code excerpt:


	static const auto CVar_MaxPhysicsDeltaTime = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("p.MaxPhysicsDeltaTime"));
	PhysScene->SetUpForFrame(&DefaultGravity, DeltaSeconds, UPhysicsSettings::Get()->MinPhysicsDeltaTime, UPhysicsSettings::Get()->MaxPhysicsDeltaTime,
		UPhysicsSettings::Get()->MaxSubstepDeltaTime, UPhysicsSettings::Get()->MaxSubsteps, UPhysicsSettings::Get()->bSubstepping);
}

void UWorld::StartPhysicsSim()
{
	FPhysScene* PhysScene = GetPhysicsScene();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/PhysicsSettings.cpp:18

Scope (from outer to inner):

file
function     UPhysicsSettings::UPhysicsSettings

Source code excerpt:

	, AnimPhysicsMinDeltaTime(0.f)
	, bSimulateAnimPhysicsAfterReset(false)
	, MinPhysicsDeltaTime(UE_SMALL_NUMBER)
	, MaxPhysicsDeltaTime(1.f / 30.f)
	, bSubstepping(false)
	, bTickPhysicsAsync(false)
	, AsyncFixedTimeStepSize(1.f / 30.f)
	, MaxSubstepDeltaTime(1.f / 60.f)
	, MaxSubsteps(6)