Files
PHY/Plugins/GMS/Source/GenericMovementSystem/Public/Settings/GMS_SettingStructLibrary.h
2026-03-03 01:23:02 +08:00

872 lines
31 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GMS_SettingEnumLibrary.h"
#include "Animation/AnimData/BoneMaskFilter.h"
#include "UObject/Object.h"
#include "Curves/CurveFloat.h"
#include "Engine/EngineTypes.h"
#include "BoneControllers/BoneControllerTypes.h"
#include "Utility/GMS_Tags.h"
#include "GMS_SettingStructLibrary.generated.h"
class UGMS_MovementSetUserSetting;
class UGMS_AnimLayerSetting_SkeletalControls;
class UGMS_MovementControlSetting_Default;
class UGMS_AnimLayerSetting_Additive;
class UGMS_CharacterMovementSetting;
class UGMS_CharacterRotationSetting;
class UGMS_AnimLayerSetting_View;
class UGMS_AnimLayerSetting_Overlay;
class UGMS_AnimLayerSetting_StateOverlays;
class UGMS_AnimLayerSetting_States;
/**
* Stores bone references for orientation warping.
* 存储用于朝向扭曲的骨骼引用。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_OrientationWarpingBoneReference
{
GENERATED_USTRUCT_BODY()
/**
* Spine bones used to counter-rotate the body to keep facing forward.
* 用于反向旋转身体以保持向前朝向的脊椎骨骼。
*/
UPROPERTY(EditAnywhere, Category="GMS")
TArray<FBoneReference> SpineBones;
/**
* IK foot root bone definition.
* IK脚根骨骼定义。
*/
UPROPERTY(EditAnywhere, Category="GMS")
FBoneReference IKFootRootBone;
/**
* IK foot bone definitions.
* IK脚骨骼定义。
*/
UPROPERTY(EditAnywhere, Category="GMS")
TArray<FBoneReference> IKFootBones;
};
/**
* Settings for the orientation warping node in the animation graph.
* 动画图中朝向扭曲节点的设置。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_OrientationWarpingSettings
{
GENERATED_BODY()
/**
* Evaluation mode for orientation warping (Graph or Manual).
* 朝向扭曲的评估模式Graph或Manual
* @note Use Manual mode for animations without root motion. 对于无根运动的动画使用Manual模式。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
EWarpingEvaluationMode Mode = EWarpingEvaluationMode::Graph;
/**
* Bone references for orientation warping.
* 朝向扭曲的骨骼引用。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS")
FGMS_OrientationWarpingBoneReference BoneReference;
/**
* Specifies how much rotation is applied to the body versus IK feet.
* 指定身体与IK脚的旋转分配比例。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS", meta=(ClampMin="0.0", ClampMax="1.0"))
float DistributedBoneOrientationAlpha = 0.75f;
/**
* Interpolation speed for reaching the final warped rotation angle (alpha per second).
* 达到最终扭曲旋转角度的插值速度每秒alpha
* @note 0 means instantaneous rotation; higher values introduce smoothing. 0表示瞬时旋转较高值引入平滑。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS", meta=(ClampMin="0.0"))
float RotationInterpSpeed = 10.f;
};
/**
* Bone references for stride warping.
* 步幅适配的骨骼引用。
*/
USTRUCT()
struct GENERICMOVEMENTSYSTEM_API FGMS_StrideWarpingBoneReference
{
GENERATED_BODY()
/**
* Pelvis bone reference.
* 骨盆骨骼引用。
*/
UPROPERTY(EditAnywhere, Category="GMS")
FBoneReference PelvisBone;
/**
* IK foot root bone reference.
* IK脚根骨骼引用。
*/
UPROPERTY(EditAnywhere, Category="GMS")
FBoneReference IKFootRootBone;
};
/**
* Foot bone definitions for stride warping.
* 步幅适配的脚骨骼定义。
*/
USTRUCT()
struct GENERICMOVEMENTSYSTEM_API FGMS_StrideWarpingFootDefinition
{
GENERATED_BODY()
/**
* IK foot bone.
* IK脚骨骼。
*/
UPROPERTY(EditAnywhere, Category="GMS")
FBoneReference IKFootBone;
/**
* FK foot bone.
* FK脚骨骼。
*/
UPROPERTY(EditAnywhere, Category="GMS")
FBoneReference FKFootBone;
/**
* Thigh bone.
* 大腿骨骼。
*/
UPROPERTY(EditAnywhere, Category="GMS")
FBoneReference ThighBone;
};
/**
* Settings for the stride warping node in the animation graph.
* 动画图中步幅适配节点的设置。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_StrideWarpingSettings
{
GENERATED_BODY()
/**
* Enables or disables stride warping.
* 启用或禁用步幅适配。
* @note Disable for non-humanoid characters. 对于非人形角色禁用。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS")
bool bEnabled{true};
/**
* Start time for blending in stride warping.
* 步幅适配混入的开始时间。
* @note For animations with turns, set to when the character moves in a straight line. 对于带转身的动画,设置为角色直线移动的时刻。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS", meta=(ClampMin=0))
float BlendInStartOffset{0.15f};
/**
* Duration for fully blending in stride warping.
* 步幅适配完全混入的持续时间。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS")
float BlendInDurationScaled{0.2f};
};
/**
* Settings for the steering node in the animation graph.
* 动画图中Steering节点的设置。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_SteeringSettings
{
GENERATED_BODY()
/**
* Default constructor.
* 默认构造函数。
*/
FGMS_SteeringSettings()
{
bEnabled = true;
ProceduralTargetTime = 0.2f;
AnimatedTargetTime = 0.5f;
}
/**
* Constructor with parameters.
* 带参数的构造函数。
* @param bInEnabled Whether steering is enabled. 是否启用Steering。
* @param InProceduralTargetTime Procedural target time. 程序化目标时间。
* @param InAnimatedTargetTime Animated target time. 动画目标时间。
*/
FGMS_SteeringSettings(bool bInEnabled, float InProceduralTargetTime, float InAnimatedTargetTime)
{
bEnabled = bInEnabled;
ProceduralTargetTime = InProceduralTargetTime;
AnimatedTargetTime = InAnimatedTargetTime;
};
/**
* Enables or disables steering.
* 启用或禁用Steering。
*/
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="GMS")
bool bEnabled{true};
/**
* Time to reach target orientation for animations without root motion rotation.
* 无根运动旋转动画达到目标朝向的时间。
* @note Large values disable procedural turns. 大值禁用程序化转身。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
float ProceduralTargetTime = 0.2f;
/**
* Time to reach target orientation for animations with root motion rotation.
* 有根运动旋转动画达到目标朝向的时间。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
float AnimatedTargetTime = 0.5f;
};
/**
* Wrapper for branch filters used in blueprint.
* 用于蓝图的分支过滤器包装器。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_InputBlendPose
{
GENERATED_USTRUCT_BODY()
/**
* Array of bone branch filters.
* 骨骼分支过滤器数组。
*/
UPROPERTY(EditAnywhere, Category=Filter)
TArray<FBranchFilter> BranchFilters;
};
/**
* General settings for the main animation instance.
* 主动画实例的通用设置。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_AnimDataSetting_General
{
GENERATED_BODY()
/**
* Allows the pawn's root bone to rotate independently of the actor's rotation.
* 允许Pawn的根骨骼独立于Actor旋转进行旋转。
* @note Global setting; animation layers should only change root rotation mode if enabled. 全局设置;动画层仅在启用时更改根旋转模式。
* @details Enables complex rotational animations like turn-in-place via root motion. 通过根运动支持复杂的旋转动画,如原地转身。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common")
bool bEnableOffsetRootBoneRotation{true};
/**
* Controls the speed of blending out root bone rotation offset.
* 控制根骨骼旋转偏移混出的速度。
* @note Closer to 0 is faster; 0 means instant blend out. 越接近0越快0表示立即混出。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common", Meta = (ClampMin = 0, ClampMax = 1, EditCondition="bEnableOffsetRootBoneRotation"))
float RootBoneRotationHalfLife{0.2};
/**
* Allows the pawn's root bone to translate independently of the actor's location.
* 允许Pawn的根骨骼独立于Actor位置进行平移。
* @note Global setting; animation layers should only change root translation mode if enabled. 全局设置;动画层仅在启用时更改根平移模式。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common")
bool bEnableOffsetRootBoneTranslation{true};
/**
* Controls the speed of blending out root bone translation offset.
* 控制根骨骼位移偏移混出的速度。
* @note Closer to 0 is faster; 0 means instant blend out. 越接近0越快0表示立即混出。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common", Meta = (ClampMin = 0, ClampMax = 1, EditCondition="bEnableOffsetRootBoneTranslation"))
float RootBoneTranslationHalfLife{0.2};
/**
* Controls the speed of lean interpolation in grounded or in-air states.
* 控制地面或空中状态下倾斜插值的速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Common", Meta = (ClampMin = 0))
float LeanInterpolationSpeed{4.0f};
/**
* Speed threshold for determining movement in animation states.
* 动画状态中确定移动的速度阈值。
*/
// UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Common", Meta = (ClampMin = 0, ForceUnits = "cm/s"))
// float MovingSmoothSpeedThreshold{150.0f};
/**
* Curve mapping vertical velocity to lean amount in air.
* 空中垂直速度到倾斜量的曲线映射。
* @note If empty, lean state is not refreshed in air. 如果为空,空中不刷新倾斜状态。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="InAir")
TObjectPtr<UCurveFloat> InAirLeanAmountCurve{nullptr};
/**
* Collision channel for ground prediction sweep.
* 地面预测扫描的碰撞通道。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="InAir")
TEnumAsByte<ECollisionChannel> GroundPredictionSweepChannel{ECC_Visibility};
/**
* Response channels for ground prediction.
* 地面预测的响应通道。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="InAir")
TArray<TEnumAsByte<ECollisionChannel>> GroundPredictionResponseChannels;
/**
* Collision response container for ground prediction sweep.
* 地面预测扫描的碰撞响应容器。
*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="InAir")
FCollisionResponseContainer GroundPredictionSweepResponses{ECR_Ignore};
#if WITH_EDITOR
/**
* Handles property changes in the editor.
* 处理编辑器中的属性更改。
* @param PropertyChangedEvent The property change event. 属性更改事件。
*/
void PostEditChangeProperty(const FPropertyChangedEvent& PropertyChangedEvent);
#endif
};
#pragma region Rotation Mode Settings
USTRUCT(BlueprintType, meta=(Hidden))
struct GENERICMOVEMENTSYSTEM_API FGMS_RotationModeSetting
{
GENERATED_BODY()
/**
* Determines if turn-in-place animation follows actor rotation or drives it.
* 确定原地转身动画是跟随Actor旋转还是驱动Actor旋转。
* @note If enabled, animation catches up with actor rotation; if disabled, it drives rotation. 如果启用动画跟随Actor旋转如果禁用动画驱动旋转。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
bool bEnableRotationWhenNotMoving{true};
};
/**
* Setting for view direction based rotation mode.
* 基于视角方向的旋转模式设置
*/
USTRUCT(BlueprintType, meta=(Hidden))
struct GENERICMOVEMENTSYSTEM_API FGMS_ViewDirectionSetting_Base : public FGMS_RotationModeSetting
{
GENERATED_BODY()
/**
* Primary rotation interpolation speed for character's rotation.
* 角色的主要旋转插值速度。
* @details Smaller value means faster InterpolationSpeed. 值越小,插值速度越大。
* @note <=0 disables smoothing. <=0禁用平滑。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
float RotationInterpolationSpeed = 0.1f;
/**
* Secondary(Extras) rotation interpolation speed for character's rotation.
* 角色的次要(额外)旋转插值速度。
* @note <=0 disables smoothing <=0禁用平滑。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
float TargetYawAngleRotationSpeed = 800.0f;
};
/**
* Setting for deprecated view direction based rotation mode.
* 基于弃用的视角方向的旋转模式设置
*/
USTRUCT(BlueprintType, meta=(Hidden))
struct FGMS_ViewDirectionSetting : public FGMS_ViewDirectionSetting_Base
{
GENERATED_BODY()
/**
* View direction mode (Default or Aiming).
* 视图方向模式(默认或瞄准)。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
EGMS_ViewDirectionMode_DEPRECATED DirectionMode{EGMS_ViewDirectionMode_DEPRECATED::Default};
/**
* Determines if turn-in-place animation follows actor rotation or drives it.
* 确定原地转身动画是跟随Actor旋转还是驱动Actor旋转。
* @note If enabled, animation catches up with actor rotation; if disabled, it drives rotation. 如果启用动画跟随Actor旋转如果禁用动画驱动旋转。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
bool bRotateToViewDirectionWhileNotMoving{true};
/**
* Minimum angle limit between character and camera orientation in aiming mode.
* 瞄准模式下角色与相机朝向的最小夹角限制。
* @note Ensures character rotation keeps up with fast camera movement. 确保角色旋转跟上快速相机移动。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(EditCondition="DirectionMode == EGMS_ViewDirectionMode_DEPRECATED::Aiming", EditConditionHides))
float MinAimingYawAngleLimit{90.0f};
};
/**
* Setting for default view direction based rotation mode.
* 基于默认的视角方向的旋转模式设置
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_ViewDirectionSetting_Default : public FGMS_ViewDirectionSetting_Base
{
GENERATED_BODY()
/**
* Primary rotation interpolation speed curve for character's rotation.
* 角色的主要旋转插值速度曲线。
* @details This curve maps the speed level of each movement state to InterpolationSpeed, allowing different rotation rate on different movement state. 此曲线将每个运动状态的速度等级映射为插值速度,允许不同运动状态下有不同的旋转速度。
* @note Only used when character is moving and have higher priority than "RotationInterpolationSpeed". 仅在角色移动时使用比“RotationInterpolationSpeed”优先级更高。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
TObjectPtr<UCurveFloat> RotationInterpolationSpeedCurve{nullptr};
};
/**
* Setting for Aiming view direction based rotation mode.
* 基于瞄准视角方向的旋转模式设置
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_ViewDirectionSetting_Aiming : public FGMS_ViewDirectionSetting_Base
{
GENERATED_BODY()
/**
* Minimum angle limit between character and camera orientation in aiming mode.
* 瞄准模式下角色与相机朝向的最小夹角限制。
* @note Ensures character rotation keeps up with fast camera movement. 确保角色旋转跟上快速相机移动。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
float MinAimingYawAngleLimit{90.0f};
};
/**
* Setting for velocity direction based rotation mode.
* 基于速率方向的旋转模式设置
* @note Velocity can come from input ,acceleration, or last movement velocity;
*/
USTRUCT(BlueprintType, meta=(Hidden))
struct GENERICMOVEMENTSYSTEM_API FGMS_VelocityDirectionSetting_Base : public FGMS_RotationModeSetting
{
GENERATED_BODY()
// If checked, the character will rotate relative to the object it is standing on in the velocity
// direction rotation mode, otherwise the character will ignore that object and keep its world rotation.
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Settings")
bool bInheritBaseRotation{false};
};
/**
* Default setting for velocity direction based rotation mode.
* 基于默认速率方向的旋转模式设置
*/
USTRUCT(BlueprintType, meta=(Hidden))
struct FGMS_VelocityDirectionSetting : public FGMS_VelocityDirectionSetting_Base
{
GENERATED_BODY()
/**
* Velocity direction mode (e.g., orient to velocity or input).
* 速度方向模式(例如,朝向速度或输入)。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
EGMS_VelocityDirectionMode_DEPRECATED DirectionMode{EGMS_VelocityDirectionMode_DEPRECATED::OrientToLastVelocityDirection};
/**
* Rotation rate for turning circle mode (degrees per second).
* 转向圆模式的旋转速率(度每秒)。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(EditCondition="DirectionMode == EGMS_VelocityDirectionMode_DEPRECATED::TurningCircle", EditConditionHides))
float TurningRate{30};
};
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_VelocityDirectionSetting_Default : public FGMS_VelocityDirectionSetting_Base
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GMS")
bool bOrientateToMoveInputIntent = false;
/**
* If true, the actor will continue orienting towards the last intended orientation (from input) even after movement intent input has ceased.
* This makes the character finish orienting after a quick stick flick from the player. If false, character will not turn without input.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GMS")
bool bMaintainLastInputOrientation = false;
/**
* Primary rotation interpolation speed for character's rotation.
* 角色的主要旋转插值速度。
* @details Smaller value means faster InterpolationSpeed. 值越小,插值速度越大。
* @note <=0 disables smoothing. <=0禁用平滑。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
float RotationInterpolationSpeed = 0.1f;
/**
* Primary rotation interpolation speed curve for character's rotation.
* 角色的主要旋转插值速度曲线。
* @details This curve maps the speed level of each movement state to InterpolationSpeed, allowing different rotation rate on different movement state. 此曲线将每个运动状态的速度等级映射为插值速度,允许不同运动状态下有不同的旋转速度。
* @note Only used when character is moving and have higher priority than "RotationInterpolationSpeed". 仅在角色移动时使用比“RotationInterpolationSpeed”优先级更高。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
TObjectPtr<UCurveFloat> RotationInterpolationSpeedCurve{nullptr};
/**
* Secondary(Extras) moothing for character's rotation speed.
* 角色旋转速度的次平滑。
* @note <=0 disables smoothing <=0禁用平滑。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
float TargetYawAngleRotationSpeed = 800.0f;
};
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_VelocityDirectionSetting_RateBased : public FGMS_VelocityDirectionSetting_Base
{
GENERATED_BODY()
/**
* Rotation rate for turning(degrees per second).
* 转向圆模式的旋转速率(度每秒)。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
float TurnRate{30};
/**
* Rotation rate for turning at different speed.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(ClampMin=0))
TObjectPtr<UCurveFloat> TurnRateSpeedCurve{nullptr};
};
#pragma endregion
/**
* Settings for in-air movement.
* 空中移动的设置。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_InAirSetting
{
GENERATED_BODY()
/**
* Curve mapping vertical velocity to lean amount.
* 垂直速度到倾斜量的曲线映射。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
TObjectPtr<UCurveFloat> LeanAmountCurve{nullptr};
/**
* Collision channel for ground prediction sweep.
* 地面预测扫描的碰撞通道。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
TEnumAsByte<ECollisionChannel> GroundPredictionSweepChannel{ECC_Visibility};
/**
* Response channels for ground prediction.
* 地面预测的响应通道。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
TArray<TEnumAsByte<ECollisionChannel>> GroundPredictionResponseChannels;
/**
* Collision response container for ground prediction sweep.
* 地面预测扫描的碰撞响应容器。
*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="GMS")
FCollisionResponseContainer GroundPredictionSweepResponses{ECR_Ignore};
};
#pragma region Movement State Settings
/**
* Settings for a single movement state (e.g., walk, jog, sprint).
* 单一运动状态的设置(例如,走、慢跑、冲刺)。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_MovementStateSetting
{
GENERATED_BODY()
/**
* Gameplay tag identifying the movement state.
* 标识运动状态的游戏标签。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", meta=(Categories="GMS.MovementState"))
FGameplayTag Tag;
/**
* Speed level of the movement state; <0 indicates reverse movement.
* 运动状态的速度级别;<0表示反向移动。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
int32 SpeedLevel = INDEX_NONE;
/**
* Speed of the movement state.
* 运动状态的速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS", Meta = (ClampMin = 0, ForceUnits = "cm/s"))
float Speed{375.0f};
/**
* Acceleration of the movement state.
* 运动状态的加速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
float Acceleration = 800.f;
/**
* Deceleration of the movement state.
* 运动状态的减速度。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
float BrakingDeceleration = 1024.f;
/**
* Allowed rotation modes for this movement state.
* 此运动状态允许的旋转模式。
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="GMS")
TArray<FGameplayTag> AllowedRotationModes{GMS_RotationModeTags::VelocityDirection, GMS_RotationModeTags::ViewDirection};
/**
* Equality operator for comparing with another movement state setting.
* 与另一个运动状态设置比较的相等运算符。
* @param Lhs Left-hand side setting. 左侧设置。
* @param RHS Right-hand side setting. 右侧设置。
* @return True if tags match. 如果标签匹配返回true。
*/
friend bool operator==(const FGMS_MovementStateSetting& Lhs, const FGMS_MovementStateSetting& RHS)
{
return Lhs.Tag == RHS.Tag;
}
/**
* Inequality operator for comparing with another movement state setting.
* 与另一个运动状态设置比较的不等运算符。
* @param Lhs Left-hand side setting. 左侧设置。
* @param RHS Right-hand side setting. 右侧设置。
* @return True if tags do not match. 如果标签不匹配返回true。
*/
friend bool operator!=(const FGMS_MovementStateSetting& Lhs, const FGMS_MovementStateSetting& RHS)
{
return !(Lhs == RHS);
}
/**
* Equality operator for comparing with a gameplay tag.
* 与游戏标签比较的相等运算符。
* @param Other The gameplay tag to compare. 要比较的游戏标签。
* @return True if tags match. 如果标签匹配返回true。
*/
bool operator==(const FGameplayTag& Other) const
{
return Tag == Other;
}
/**
* Inequality operator for comparing with a gameplay tag.
* 与游戏标签比较的不等运算符。
* @param Other The gameplay tag to compare. 要比较的游戏标签。
* @return True if tags do not match. 如果标签不匹配返回true。
*/
bool operator!=(const FGameplayTag& Other) const
{
return Tag != Other;
}
#if WITH_EDITORONLY_DATA
/**
* Velocity direction settings for this movement state.
* 此运动状态的速度方向设置。
*/
UE_DEPRECATED(1.5, "Settings for rotation mode was decoupd from movementstate, see Movement Control Setting.")
UPROPERTY(VisibleAnywhere, Category="Deprecated", meta=(EditCondition=false, EditConditionHides))
FGMS_VelocityDirectionSetting VelocityDirectionSetting;
/**
* View direction settings for this movement state.
* 此运动状态的视图方向设置。
*/
UE_DEPRECATED(1.5, "Settings for rotation mode was decoupd from movementstate, see Movement Control Setting.")
UPROPERTY(VisibleAnywhere, Category="Deprecated", meta=(EditCondition=false, EditConditionHides))
FGMS_ViewDirectionSetting ViewDirectionSetting;
/**
* Primary smoothing for character's rotation speed.
* 角色旋转的主平滑速度。
* @note <=0 disables smoothing. <=0禁用平滑。
*/
UE_DEPRECATED(1.5, "Settings for rotation mode was decoupd from movementstate, see Movement Control Setting.")
UPROPERTY(VisibleAnywhere, Category="Deprecated", meta=(ClampMin=0, EditCondition=false, EditConditionHides))
float RotationInterpolationSpeed = 12.0f;
/**
* Speed for smoothing SmoothTargetYawAngle to TargetYawAngle.
* 将SmoothTargetYawAngle平滑到TargetYawAngle的速度。
* @note <=0 disables smoothing (instant transition). <=0禁用平滑瞬时过渡
*/
UE_DEPRECATED(1.5, "Settings for rotation mode was decoupd from movementstate, see Movement Control Setting.")
UPROPERTY(VisibleAnywhere, Category="Deprecated", meta=(ClampMin=0, EditCondition=false, EditConditionHides))
float TargetYawAngleRotationSpeed = 800.0f;
/**
* Editor-friendly name for the movement state.
* 运动状态的编辑器友好名称。
*/
UPROPERTY(EditAnywhere, Category="Settings", meta=(EditCondition=false, EditConditionHides))
FString EditorFriendlyName;
#endif
};
#pragma endregion
/**
* Defines control and animation settings for a movement set.
* 定义运动集的控制和动画设置。
*/
USTRUCT(BlueprintType)
struct GENERICMOVEMENTSYSTEM_API FGMS_MovementSetSetting
{
GENERATED_BODY()
/**
* Default movement control setting.
* 默认运动控制设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Control")
TObjectPtr<UGMS_MovementControlSetting_Default> ControlSetting;
/**
* Enables per-overlay mode control settings.
* 启用按叠层模式的控制设置。
* @note If no control setting is found for an overlay mode, the default is used. 如果未找到叠层模式的控制设置,则使用默认设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Control")
bool bControlSettingPerOverlayMode{false};
/**
* Maps overlay modes to specific control settings.
* 将叠层模式映射到特定控制设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Control", meta=(Categories="GMS.OverlayMode", EditCondition="bControlSettingPerOverlayMode"))
TMap<FGameplayTag, TObjectPtr<UGMS_MovementControlSetting_Default>> ControlSettings;
/**
* General animation settings shared across the movement set.
* 运动集共享的通用动画设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Animation")
FGMS_AnimDataSetting_General AnimDataSetting_General;
/**
* Determines if instanced states settings are used.
* 确定是否使用实例化的状态设置。
* @note Uncheck if multiple movement sets share the same states layer setting. 如果多个运动集共享相同的状态层设置,则取消勾选。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Animation")
bool bUseInstancedStatesSetting{true};
/**
* Settings for the states animation layer (instanced).
* 状态动画层的设置(实例化)。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category="Animation", meta = (EditCondition="bUseInstancedStatesSetting", EditConditionHides, DisplayName="Anim Layer Setting (States)"))
TObjectPtr<UGMS_AnimLayerSetting_States> AnimLayerSetting_States;
/**
* Settings for the states animation layer (non-instanced).
* 状态动画层的设置(非实例化)。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Animation",
meta = (EditCondition="!bUseInstancedStatesSetting", EditConditionHides, DisplayName="Anim Layer Setting (States)"))
TObjectPtr<UGMS_AnimLayerSetting_States> DA_AnimLayerSetting_States;
/**
* Determines if instanced overlay settings are used.
* 确定是否使用实例化的叠层设置。
* @note Uncheck if multiple movement sets share the same overlay layer setting. 如果多个运动集共享相同的叠层设置,则取消勾选。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Animation")
bool bUseInstancedOverlaySetting{true};
/**
* Settings for the overlay animation layer (non-instanced).
* 叠层动画层的设置(非实例化)。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Animation",
meta = (EditCondition="!bUseInstancedOverlaySetting", EditConditionHides, DisplayName="Anim Layer Setting (Overlay)"))
TObjectPtr<UGMS_AnimLayerSetting_Overlay> DA_AnimLayerSetting_Overlay;
/**
* Settings for the overlay animation layer (instanced).
* 叠层动画层的设置(实例化)。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category="Animation",
meta = (EditCondition="bUseInstancedOverlaySetting", EditConditionHides, DisplayName="Anim Layer Setting (Overlay)"))
TObjectPtr<UGMS_AnimLayerSetting_Overlay> AnimLayerSetting_Overlay;
/**
* Settings for the view animation layer.
* 视图动画层的设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category="Animation", meta = (DisplayName="Anim Layer Setting (View)"))
TObjectPtr<UGMS_AnimLayerSetting_View> AnimLayerSetting_View;
/**
* Settings for the additive animation layer.
* 附加动画层的设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category="Animation", meta = (DisplayName="Anim Layer Setting (Additive)"))
TObjectPtr<UGMS_AnimLayerSetting_Additive> AnimLayerSetting_Additive;
/**
* Settings for the skeletal controls animation layer.
* 骨骼控制动画层的设置。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category="Animation", meta = (DisplayName="Anim Layer Setting (SkeletalControls)"))
TObjectPtr<UGMS_AnimLayerSetting_SkeletalControls> AnimLayerSetting_SkeletalControls;
/**
* Custom user settings for the movement set.
* 运动集的自定义用户设置。
* @note Subclass UGMS_MovementSetUserSetting and consume in animation layer blueprints. 子类化UGMS_MovementSetUserSetting并在动画层蓝图中使用。
* @example Access via GetMovementSystemComponent()->GetMovementSetSetting()->GetMovementSetUserSetting(SettingClass). 通过GetMovementSystemComponent()->GetMovementSetSetting()->GetMovementSetUserSetting(SettingClass)访问。
*/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category="Extension", meta=(AllowAbstract=false))
TArray<TObjectPtr<UGMS_MovementSetUserSetting>> UserSettings;
};