p.Chaos.CharacterGroundConstraint.InputMovementThreshold

p.Chaos.CharacterGroundConstraint.InputMovementThreshold

#Overview

name: p.Chaos.CharacterGroundConstraint.InputMovementThreshold

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.CharacterGroundConstraint.InputMovementThreshold is to define a minimum per-frame input movement distance for character movement in the Chaos physics system of Unreal Engine 5.

This setting variable is primarily used in the Chaos physics subsystem, specifically within the character movement and ground constraint components. It’s part of the experimental Chaos physics engine in Unreal Engine 5.

The value of this variable is set in the C++ code, initialized to 0.1f (centimeters). It’s defined as a console variable, which means it can be adjusted at runtime through the console or configuration files.

The associated variable Chaos_CharacterGroundConstraint_InputMovementThreshold directly interacts with it. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the sensitivity of character movement. It sets a threshold below which input movements are considered negligible. This can impact the responsiveness and precision of character controls, especially for small movements.

Best practices when using this variable include:

  1. Fine-tuning it based on the scale and movement requirements of your game characters.
  2. Testing with different values to find the right balance between responsiveness and stability.
  3. Considering the impact on both player-controlled and AI characters.
  4. Being cautious when modifying it, as it can significantly affect character movement behavior.

Regarding the associated variable Chaos_CharacterGroundConstraint_InputMovementThreshold:

The purpose of this variable is the same as p.Chaos.CharacterGroundConstraint.InputMovementThreshold. It’s used internally within the Chaos physics system to represent the console variable.

This variable is used in the Chaos physics subsystem, specifically in the character ground constraint logic.

Its value is set by the console variable system when p.Chaos.CharacterGroundConstraint.InputMovementThreshold is modified.

It directly interacts with p.Chaos.CharacterGroundConstraint.InputMovementThreshold and is used in calculations to determine if a character’s movement is significant enough to update its position.

Developers should be aware that this is the actual variable used in the physics calculations, while p.Chaos.CharacterGroundConstraint.InputMovementThreshold is the exposed console variable.

Best practices include:

  1. Using this variable for read-only purposes in custom physics code.
  2. Modifying its value through the console variable system rather than directly.
  3. Understanding that changes to this variable will directly impact character movement behavior in the physics simulation.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Character/CharacterGroundConstraintContainer.cpp:10

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

	{
		float Chaos_CharacterGroundConstraint_InputMovementThreshold = 0.1f;
		FAutoConsoleVariableRef CVarChaos_CharacterGroundConstraint_InputMovementThreshold(TEXT("p.Chaos.CharacterGroundConstraint.InputMovementThreshold"), Chaos_CharacterGroundConstraint_InputMovementThreshold, TEXT("Minimum per frame input movement distance in cm."));
		
		float Chaos_CharacterGroundConstraint_ExternalMovementThreshold = 2.0f;
		FAutoConsoleVariableRef CVarChaos_CharacterGroundConstraint_ExternalMovementThreshold(TEXT("p.Chaos.CharacterGroundConstraint.ExternalMovementThreshold"), Chaos_CharacterGroundConstraint_ExternalMovementThreshold, TEXT("If distance moved is less than this then retain current movement target relative to ground."));
	}
	
	FCharacterGroundConstraintContainer::FCharacterGroundConstraintContainer()

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Character/CharacterGroundConstraintContainer.cpp:9

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

	namespace CVars
	{
		float Chaos_CharacterGroundConstraint_InputMovementThreshold = 0.1f;
		FAutoConsoleVariableRef CVarChaos_CharacterGroundConstraint_InputMovementThreshold(TEXT("p.Chaos.CharacterGroundConstraint.InputMovementThreshold"), Chaos_CharacterGroundConstraint_InputMovementThreshold, TEXT("Minimum per frame input movement distance in cm."));
		
		float Chaos_CharacterGroundConstraint_ExternalMovementThreshold = 2.0f;
		FAutoConsoleVariableRef CVarChaos_CharacterGroundConstraint_ExternalMovementThreshold(TEXT("p.Chaos.CharacterGroundConstraint.ExternalMovementThreshold"), Chaos_CharacterGroundConstraint_ExternalMovementThreshold, TEXT("If distance moved is less than this then retain current movement target relative to ground."));
	}
	
	FCharacterGroundConstraintContainer::FCharacterGroundConstraintContainer()

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Character/CharacterGroundConstraintContainer.h:18

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

	namespace CVars
	{
		CHAOS_API extern float Chaos_CharacterGroundConstraint_InputMovementThreshold;
		CHAOS_API extern float Chaos_CharacterGroundConstraint_ExternalMovementThreshold;
	}

	class FCharacterGroundConstraintContainer;
	namespace Private
	{

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Character/CharacterGroundConstraintContainer.h:77

Scope (from outer to inner):

file
namespace    Chaos
class        class FCharacterGroundConstraintHandle final : public TIntrusiveConstraintHandle<FCharacterGroundConstraintHandle>
function     void SetData

Source code excerpt:

			// changed by much then it gets clamped to zero and we recompute the delta
			// position based on the previous target to avoid drift
			const float InputMovementThresholdSq = CVars::Chaos_CharacterGroundConstraint_InputMovementThreshold * CVars::Chaos_CharacterGroundConstraint_InputMovementThreshold;
			const float MovementThresholdSq = CVars::Chaos_CharacterGroundConstraint_ExternalMovementThreshold * CVars::Chaos_CharacterGroundConstraint_ExternalMovementThreshold;
			if ((InData.TargetDeltaPosition.SizeSquared() > InputMovementThresholdSq) || ((NewLocalCharacterPosition - LocalCharacterPosition).SizeSquared() > MovementThresholdSq))
			{
				LocalCharacterPosition = NewLocalCharacterPosition;
			}
			else