p.Chaos.Solver.Joint.Priority

p.Chaos.Solver.Joint.Priority

#Overview

name: p.Chaos.Solver.Joint.Priority

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.Joint.Priority is to set the priority for joint constraints in the Chaos physics solver. This setting variable is part of the constraint solving system within Unreal Engine’s Chaos physics simulation.

Based on the callsites, this setting variable is primarily used in the Chaos physics module, specifically within the PBDRigidsEvolutionGBF (Position Based Dynamics Rigids Evolution) component.

The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 0 and can be changed using the console command “p.Chaos.Solver.Joint.Priority”.

This variable interacts with other similar priority variables for different constraint types, such as collision, suspension, and character ground constraints. These priorities determine the order in which different types of constraints are evaluated during the physics simulation.

Developers should be aware that:

  1. Higher priority values mean the constraint is evaluated later in the simulation step.
  2. The default value is 0, but it can be adjusted to fine-tune the physics simulation behavior.
  3. Changing this value can affect the stability and accuracy of joint simulations in the physics system.

Best practices when using this variable include:

  1. Only adjust it if you’re experiencing specific issues with joint behavior in your physics simulations.
  2. Test thoroughly after making changes, as it can have subtle effects on the overall physics simulation.
  3. Consider the relative priorities of other constraint types when adjusting this value.

Regarding the associated variable ChaosSolverJointPriority:

This is the actual integer variable that stores the priority value. It’s used internally by the Chaos solver to determine the evaluation order of joint constraints. The p.Chaos.Solver.Joint.Priority console variable is linked to this internal variable, allowing it to be modified at runtime.

The ChaosSolverJointPriority variable is used directly in the FPBDRigidsEvolutionGBF constructor to set the priority of the JointConstraints container. This demonstrates how the priority value is applied within the physics solver’s constraint system.

When working with ChaosSolverJointPriority, developers should remember that changes to this variable through the console command will directly affect the behavior of the joint constraints in the physics simulation. It’s important to use this in conjunction with other priority settings to achieve the desired physics behavior in your game or application.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:74

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		int32 ChaosSolverJointPriority = 0;
		FAutoConsoleVariableRef CVarChaosSolverJointPriority(TEXT("p.Chaos.Solver.Joint.Priority"), ChaosSolverJointPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

		int32 ChaosSolverSuspensionPriority = 0;
		FAutoConsoleVariableRef CVarChaosSolverSuspensionPriority(TEXT("p.Chaos.Solver.Suspension.Priority"), ChaosSolverSuspensionPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

		int32 ChaosSolverCharacterGroundConstraintPriority = 0;
		FAutoConsoleVariableRef CVarChaosSolverChaosCharacterGroundConstraintPriority(TEXT("p.Chaos.Solver.CharacterGroundConstraint.Priority"), ChaosSolverCharacterGroundConstraintPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:73

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		FAutoConsoleVariableRef CVarChaosSolverCollisionPriority(TEXT("p.Chaos.Solver.Collision.Priority"), ChaosSolverCollisionPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

		int32 ChaosSolverJointPriority = 0;
		FAutoConsoleVariableRef CVarChaosSolverJointPriority(TEXT("p.Chaos.Solver.Joint.Priority"), ChaosSolverJointPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

		int32 ChaosSolverSuspensionPriority = 0;
		FAutoConsoleVariableRef CVarChaosSolverSuspensionPriority(TEXT("p.Chaos.Solver.Suspension.Priority"), ChaosSolverSuspensionPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

		int32 ChaosSolverCharacterGroundConstraintPriority = 0;
		FAutoConsoleVariableRef CVarChaosSolverChaosCharacterGroundConstraintPriority(TEXT("p.Chaos.Solver.CharacterGroundConstraint.Priority"), ChaosSolverCharacterGroundConstraintPriority, TEXT("Set constraint priority. Larger values are evaluated later [def:0]"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:1110

Scope (from outer to inner):

file
namespace    Chaos
function     FPBDRigidsEvolutionGBF::FPBDRigidsEvolutionGBF

Source code excerpt:

	AddConstraintContainer(SuspensionConstraints, ChaosSolverSuspensionPriority);
	AddConstraintContainer(CollisionConstraints, ChaosSolverCollisionPriority);
	AddConstraintContainer(JointConstraints, ChaosSolverJointPriority);
	AddConstraintContainer(CharacterGroundConstraints, ChaosSolverCharacterGroundConstraintPriority);

	SetInternalParticleInitilizationFunction([](const FGeometryParticleHandle*, const FGeometryParticleHandle*) {});
}

FPBDRigidsEvolutionGBF::~FPBDRigidsEvolutionGBF()