p.Cloth.ResetAfterTeleport
p.Cloth.ResetAfterTeleport
#Overview
name: p.Cloth.ResetAfterTeleport
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Require p.Cloth.TeleportOverride. Reset the clothing after moving the clothing position (called teleport).\n Default: true.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Cloth.ResetAfterTeleport is to control whether clothing should be reset after a teleportation event in Unreal Engine’s cloth simulation system. This setting is part of the cloth physics simulation functionality within the engine.
This setting variable is primarily used in the Unreal Engine’s skeletal mesh component, specifically in the cloth simulation subsystem. It’s referenced in the SkeletalMeshComponentPhysics.cpp file, which is part of the Engine module.
The value of this variable is set as a console variable (CVar) with a default value of true. It can be modified at runtime through the console or programmatically.
This variable interacts closely with other cloth-related variables, particularly p.Cloth.TeleportOverride. The ResetAfterTeleport setting only takes effect if TeleportOverride is enabled.
Developers must be aware that this setting is part of a group of cloth teleportation-related variables. It works in conjunction with distance and rotation thresholds to determine when and how cloth should be reset during teleportation events.
Best practices when using this variable include:
- Ensure p.Cloth.TeleportOverride is set to true for this setting to take effect.
- Consider the performance implications of frequent cloth resets, especially in scenes with many cloth-simulated objects.
- Use in combination with p.Cloth.TeleportDistanceThreshold and p.Cloth.TeleportRotationThreshold for fine-tuned control over cloth behavior during teleportation.
Regarding the associated variable CVarClothResetAfterTeleport:
The purpose of CVarClothResetAfterTeleport is to provide a programmatic way to access and modify the p.Cloth.ResetAfterTeleport setting within the C++ code of the engine.
This variable is used within the USkeletalMeshComponent class, specifically in the CheckClothTeleport function. It’s part of the cloth simulation logic in the skeletal mesh system.
The value of CVarClothResetAfterTeleport is set when the console variable p.Cloth.ResetAfterTeleport is initialized, and it can be accessed at runtime using the GetValueOnGameThread() method.
CVarClothResetAfterTeleport interacts with other cloth-related console variables, particularly CVarClothTeleportOverride.
Developers should be aware that this variable provides a way to read the current state of the p.Cloth.ResetAfterTeleport setting within C++ code. It’s particularly useful when implementing custom cloth behavior or debugging cloth-related issues.
Best practices for using CVarClothResetAfterTeleport include:
- Always check CVarClothTeleportOverride before using this variable, as its effect is conditional on the override being enabled.
- Use GetValueOnGameThread() to ensure thread-safe access to the current value.
- Consider caching the value if it’s accessed frequently, to avoid potential performance overhead from repeated console variable queries.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SkeletalMeshComponentPhysics.cpp:54
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarClothTeleportOverride(TEXT("p.Cloth.TeleportOverride"), false, TEXT("Force console variable teleport override values over skeletal mesh properties.\n Default: false."));
static TAutoConsoleVariable<bool> CVarClothResetAfterTeleport(TEXT("p.Cloth.ResetAfterTeleport"), true, TEXT("Require p.Cloth.TeleportOverride. Reset the clothing after moving the clothing position (called teleport).\n Default: true."));
static TAutoConsoleVariable<float> CVarClothTeleportDistanceThreshold(TEXT("p.Cloth.TeleportDistanceThreshold"), 300.f, TEXT("Require p.Cloth.TeleportOverride. Conduct teleportation if the character's movement is greater than this threshold in 1 frame.\n Zero or negative values will skip the check.\n Default: 300."));
static TAutoConsoleVariable<float> CVarClothTeleportRotationThreshold(TEXT("p.Cloth.TeleportRotationThreshold"), 0.f, TEXT("Require p.Cloth.TeleportOverride. Rotation threshold in degrees, ranging from 0 to 180.\n Conduct teleportation if the character's rotation is greater than this threshold in 1 frame.\n Zero or negative values will skip the check.\n Default 0."));
static TAutoConsoleVariable<int32> CVarEnableKinematicDeferralPrePhysicsCondition(TEXT("p.EnableKinematicDeferralPrePhysicsCondition"), 1, TEXT("If is 1, and deferral would've been disallowed due to EUpdateTransformFlags, allow if in PrePhysics tick. If 0, condition is unchanged."));
//This is the total cloth time split up among multiple computation (updating gpu, updating sim, etc...)
#Associated Variable and Callsites
This variable is associated with another variable named CVarClothResetAfterTeleport
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SkeletalMeshComponentPhysics.cpp:54
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarClothTeleportOverride(TEXT("p.Cloth.TeleportOverride"), false, TEXT("Force console variable teleport override values over skeletal mesh properties.\n Default: false."));
static TAutoConsoleVariable<bool> CVarClothResetAfterTeleport(TEXT("p.Cloth.ResetAfterTeleport"), true, TEXT("Require p.Cloth.TeleportOverride. Reset the clothing after moving the clothing position (called teleport).\n Default: true."));
static TAutoConsoleVariable<float> CVarClothTeleportDistanceThreshold(TEXT("p.Cloth.TeleportDistanceThreshold"), 300.f, TEXT("Require p.Cloth.TeleportOverride. Conduct teleportation if the character's movement is greater than this threshold in 1 frame.\n Zero or negative values will skip the check.\n Default: 300."));
static TAutoConsoleVariable<float> CVarClothTeleportRotationThreshold(TEXT("p.Cloth.TeleportRotationThreshold"), 0.f, TEXT("Require p.Cloth.TeleportOverride. Rotation threshold in degrees, ranging from 0 to 180.\n Conduct teleportation if the character's rotation is greater than this threshold in 1 frame.\n Zero or negative values will skip the check.\n Default 0."));
static TAutoConsoleVariable<int32> CVarEnableKinematicDeferralPrePhysicsCondition(TEXT("p.EnableKinematicDeferralPrePhysicsCondition"), 1, TEXT("If is 1, and deferral would've been disallowed due to EUpdateTransformFlags, allow if in PrePhysics tick. If 0, condition is unchanged."));
//This is the total cloth time split up among multiple computation (updating gpu, updating sim, etc...)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SkeletalMeshComponentPhysics.cpp:3585
Scope (from outer to inner):
file
function void USkeletalMeshComponent::CheckClothTeleport
Source code excerpt:
if (CVarClothTeleportOverride.GetValueOnGameThread())
{
bResetAfterTeleportOverride = CVarClothResetAfterTeleport.GetValueOnGameThread();
TeleportDistanceThresholdOverride = CVarClothTeleportDistanceThreshold.GetValueOnGameThread();
ClothTeleportDistThresholdSquaredOverride = FMath::Square(TeleportDistanceThresholdOverride);
TeleportRotationThresholdOverride = CVarClothTeleportRotationThreshold.GetValueOnGameThread();
ClothTeleportCosineThresholdInRadOverride = FMath::Cos(FMath::DegreesToRadians(TeleportRotationThresholdOverride));
}
else