p.Chaos.Joint.VelProjectionAlpha

p.Chaos.Joint.VelProjectionAlpha

#Overview

name: p.Chaos.Joint.VelProjectionAlpha

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Joint.VelProjectionAlpha is to control the amount of velocity correction applied during joint projection in the Chaos physics system of Unreal Engine 5. This setting is specifically related to the joint constraints in the physics simulation.

This setting variable is primarily used in the Chaos physics subsystem, which is an experimental physics engine in Unreal Engine 5. It’s particularly relevant to the joint constraint solver module within Chaos.

The value of this variable is set in the JointConstraintsCVars.cpp file, with a default value of 0.1f. It can be modified at runtime through the Unreal Engine console variable system.

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

Developers must be aware that this variable affects the behavior of joint constraints in physics simulations. It determines how much of the velocity correction is applied during projection, which can impact the stability and realism of joint movements.

Best practices when using this variable include:

  1. Carefully adjusting its value to balance between stability and responsiveness of joint constraints.
  2. Testing thoroughly with different values in various physics scenarios to ensure desired behavior.
  3. Being cautious when modifying it at runtime, as it can significantly affect ongoing physics simulations.

Regarding the associated variable Chaos_Joint_VelProjectionAlpha:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/JointConstraintsCVars.cpp:11

Scope: file

Source code excerpt:


float Chaos_Joint_VelProjectionAlpha = 0.1f;
FAutoConsoleVariableRef CVarChaosJointVelProjectionScale(TEXT("p.Chaos.Joint.VelProjectionAlpha"), Chaos_Joint_VelProjectionAlpha, TEXT("How much of the velocity correction to apply during projection. Equivalent to (1-damping) for projection velocity delta"));

bool bChaos_Joint_DisableSoftLimits = false;
FAutoConsoleVariableRef CVarChaosJointDisableSoftLimits(TEXT("p.Chaos.Joint.DisableSoftLimits"), bChaos_Joint_DisableSoftLimits, TEXT("Disable soft limits (for debugging only)"));

bool bChaos_Joint_Plasticity_ClampToLimits = true;
FAutoConsoleVariableRef CVarChaosJointPlasticityClampToLimits(TEXT("p.Chaos.Joint.Plasticity.ClampToLimits"), bChaos_Joint_Plasticity_ClampToLimits, TEXT("Clamp drive position targets to defined limits after plasticity computation"));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosJointDegenerateRotationLimit(TEXT("p.Chaos.Joint.DegenerateRotationLimit"), Chaos_Joint_DegenerateRotationLimit, TEXT("Cosine of the swing angle that is considered degerenerate (default Cos(176deg))"));

float Chaos_Joint_VelProjectionAlpha = 0.1f;
FAutoConsoleVariableRef CVarChaosJointVelProjectionScale(TEXT("p.Chaos.Joint.VelProjectionAlpha"), Chaos_Joint_VelProjectionAlpha, TEXT("How much of the velocity correction to apply during projection. Equivalent to (1-damping) for projection velocity delta"));

bool bChaos_Joint_DisableSoftLimits = false;
FAutoConsoleVariableRef CVarChaosJointDisableSoftLimits(TEXT("p.Chaos.Joint.DisableSoftLimits"), bChaos_Joint_DisableSoftLimits, TEXT("Disable soft limits (for debugging only)"));

bool bChaos_Joint_Plasticity_ClampToLimits = true;
FAutoConsoleVariableRef CVarChaosJointPlasticityClampToLimits(TEXT("p.Chaos.Joint.Plasticity.ClampToLimits"), bChaos_Joint_Plasticity_ClampToLimits, TEXT("Clamp drive position targets to defined limits after plasticity computation"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/JointConstraintsCVars.h:18

Scope: file

Source code excerpt:

extern float Chaos_Joint_DegenerateRotationLimit;

extern float Chaos_Joint_VelProjectionAlpha;

extern bool bChaos_Joint_DisableSoftLimits;

extern bool bChaos_Joint_Plasticity_ClampToLimits;

extern float Chaos_Joint_LinearVelocityThresholdToApplyRestitution;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointCachedSolverGaussSeidel.cpp:1388

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDJointCachedSolver::ApplyProjections

Source code excerpt:

		// Add velocity correction from the net projection motion
		// @todo(chaos): this should be a joint setting?
		if (Chaos_Joint_VelProjectionAlpha > 0.0f)
		{
			const FSolverReal VelocityScale = Chaos_Joint_VelProjectionAlpha  / static_cast<FSolverReal>(Dt);
			const FSolverVec3 DV1 = Body1().DP() * VelocityScale;
			const FSolverVec3 DW1 = Body1().DQ()* VelocityScale;
		
			Body(1).ApplyVelocityDelta(DV1, DW1);
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Joint/PBDJointSolverGaussSeidel.cpp:412

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDJointSolver::ApplyProjections

Source code excerpt:


				// Add velocity correction from the net projection motion
				if (Chaos_Joint_VelProjectionAlpha > 0.0f)
				{
					ApplyVelocityProjection(Dt, SolverSettings, JointSettings, Chaos_Joint_VelProjectionAlpha, DP1, DR1);
				}
			}
		}
	}