p.EnableSkeletalMeshConstraints
p.EnableSkeletalMeshConstraints
#Overview
name: p.EnableSkeletalMeshConstraints
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable skeletal mesh constraints defined within the Physics Asset Editor
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.EnableSkeletalMeshConstraints is to control the enabling or disabling of skeletal mesh constraints defined within the Physics Asset Editor in Unreal Engine 5.
This setting variable is primarily used in the physics engine subsystem of Unreal Engine 5, specifically in the constraint handling system for skeletal meshes.
The value of this variable is set using an FAutoConsoleVariableRef, which creates a console variable that can be adjusted at runtime. It is initialized to true by default.
The associated variable bEnableSkeletalMeshConstraints directly interacts with p.EnableSkeletalMeshConstraints. They share the same value and purpose.
Developers must be aware that this variable significantly impacts the behavior of skeletal mesh physics, particularly for ragdolls. Disabling this variable (setting it to false) can have negative impacts on ragdolls, especially if they start in a kinematic state and then have their bodies turned dynamic.
Best practices when using this variable include:
- Keeping it enabled (true) for most scenarios to ensure proper physics behavior for skeletal meshes.
- If disabling it, thoroughly testing ragdoll and other skeletal mesh physics interactions to ensure desired behavior.
- Using it in conjunction with the Physics Asset Editor for fine-tuning skeletal mesh constraints.
Regarding the associated variable bEnableSkeletalMeshConstraints:
The purpose of bEnableSkeletalMeshConstraints is identical to p.EnableSkeletalMeshConstraints - it controls the enabling or disabling of skeletal mesh constraints.
This variable is used directly in the physics engine’s constraint creation logic. When true, it allows the creation of constraints between physics objects for skeletal meshes.
The value of this variable is set by the console variable p.EnableSkeletalMeshConstraints.
bEnableSkeletalMeshConstraints is used in the CreateJoint_AssumesLocked function to determine whether to create a constraint between two physics objects.
Developers should be aware that this variable directly controls the creation of physics constraints for skeletal meshes. If set to false, no constraints will be created, which can significantly alter the behavior of skeletal mesh physics.
Best practices for using bEnableSkeletalMeshConstraints include:
- Avoid modifying this variable directly in code; instead, use the console variable p.EnableSkeletalMeshConstraints to change its value.
- When debugging physics issues related to skeletal meshes, checking the state of this variable can be crucial.
- If custom physics behavior is required, consider creating a derived class or using other physics settings rather than globally disabling skeletal mesh constraints.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ConstraintInstance.cpp:46
Scope: file
Source code excerpt:
bool bEnableSkeletalMeshConstraints = true;
FAutoConsoleVariableRef CVarEnableSkeletalMeshConstraints(TEXT("p.EnableSkeletalMeshConstraints"), bEnableSkeletalMeshConstraints, TEXT("Enable skeletal mesh constraints defined within the Physics Asset Editor"));
// warning : setting the value to false can have negative impact on ragdoll, if they start in a kinematic state and then have their bodies turned dynamic
bool bAllowKinematicKinematicConstraints = true;
FAutoConsoleVariableRef CVarAllowKinematicKinematicConstraints(TEXT("p.AllowKinematicKinematicConstraints"), bAllowKinematicKinematicConstraints, TEXT("Do not create constraints between two rigid kinematics."));
/** Handy macro for setting BIT of VAR based on the bool CONDITION */
#Associated Variable and Callsites
This variable is associated with another variable named bEnableSkeletalMeshConstraints
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ConstraintInstance.cpp:45
Scope: file
Source code excerpt:
ECVF_ReadOnly);
bool bEnableSkeletalMeshConstraints = true;
FAutoConsoleVariableRef CVarEnableSkeletalMeshConstraints(TEXT("p.EnableSkeletalMeshConstraints"), bEnableSkeletalMeshConstraints, TEXT("Enable skeletal mesh constraints defined within the Physics Asset Editor"));
// warning : setting the value to false can have negative impact on ragdoll, if they start in a kinematic state and then have their bodies turned dynamic
bool bAllowKinematicKinematicConstraints = true;
FAutoConsoleVariableRef CVarAllowKinematicKinematicConstraints(TEXT("p.AllowKinematicKinematicConstraints"), bAllowKinematicKinematicConstraints, TEXT("Do not create constraints between two rigid kinematics."));
/** Handy macro for setting BIT of VAR based on the bool CONDITION */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ConstraintInstance.cpp:522
Scope (from outer to inner):
file
function bool FConstraintInstance::CreateJoint_AssumesLocked
Source code excerpt:
checkf(Local2.IsValid() && !Local2.ContainsNaN(), TEXT("%s"), *Local2.ToString());
if (bEnableSkeletalMeshConstraints)
{
ConstraintHandle = FPhysicsInterface::CreateConstraint(Body1, Body2, Local1, Local2);
}
if(!ConstraintHandle.IsValid())
{
UE_LOG(LogPhysics, Log, TEXT("FConstraintInstance::CreatePxJoint_AssumesLocked - Invalid 6DOF joint (%s)"), *JointName.ToString());