Refactored FOLSMovementDirectionThresholds

This commit is contained in:
mrlee207 2025-08-05 12:37:14 +07:00
parent 6aa23dcddf
commit c0c05e57be
4 changed files with 23 additions and 22 deletions

View File

@ -626,10 +626,7 @@ void UOLSBaseLayerAnimInstance::GetMovementDirectionThresholds(const EOLSMovemen
{ {
if (movementDirection == EOLSMovementDirection::EForward || movementDirection == EOLSMovementDirection::EBackward) if (movementDirection == EOLSMovementDirection::EForward || movementDirection == EOLSMovementDirection::EBackward)
{ {
outMovementThresholds.FL = -60.f; FOLSMovementDirectionThresholds::UpdateThresholds(-60.f, 60.f, -120.f, 120.f, outMovementThresholds);
outMovementThresholds.FR = 60.f;
outMovementThresholds.BL = -120.f;
outMovementThresholds.BR = 120.f;
return; return;
} }
@ -639,27 +636,14 @@ void UOLSBaseLayerAnimInstance::GetMovementDirectionThresholds(const EOLSMovemen
{ {
if (bIsPivoting) if (bIsPivoting)
{ {
outMovementThresholds.FL = -60.f; FOLSMovementDirectionThresholds::UpdateThresholds(-60.f, 60.f, -120.f, 120.f, outMovementThresholds);
outMovementThresholds.FR = 60.f;
outMovementThresholds.BL = -120.f;
outMovementThresholds.BR = 120.f;
} }
else else
{ {
if (bIsLooping && IsAimingDirection()) (bIsLooping && !IsAimingDirection()
{ ? FOLSMovementDirectionThresholds::UpdateThresholds(-60.f, 60.f, -140.f, 140.f, outMovementThresholds)
outMovementThresholds.FL = -60.f; : FOLSMovementDirectionThresholds::UpdateThresholds(-40.f, 40.f, -120.f, 120.f,
outMovementThresholds.FR = 60.f; outMovementThresholds));
outMovementThresholds.BL = -140.f;
outMovementThresholds.BR = 140.f;
}
else
{
outMovementThresholds.FL = -40.f;
outMovementThresholds.FR = 40.f;
outMovementThresholds.BL = -120.f;
outMovementThresholds.BR = 120.f;
}
} }
} }
} }

View File

@ -5,6 +5,15 @@
#include "Data/OLSEnumLibrary.h" #include "Data/OLSEnumLibrary.h"
void FOLSMovementDirectionThresholds::UpdateThresholds(const float fl, const float fr, const float bl, const float br,
FOLSMovementDirectionThresholds& outMovementThresholds)
{
outMovementThresholds.FL = fl;
outMovementThresholds.FR = fr;
outMovementThresholds.BL = bl;
outMovementThresholds.BR = br;
}
void FOLSFeetPositionData::DetermineIfRightFootIsFront() void FOLSFeetPositionData::DetermineIfRightFootIsFront()
{ {
const FVector rightFootLocal = RootTransform.InverseTransformPosition(RightFootLocation); const FVector rightFootLocal = RootTransform.InverseTransformPosition(RightFootLocation);

View File

@ -32,6 +32,14 @@ struct FOLSMovementDirectionThresholds
{ {
GENERATED_BODY() GENERATED_BODY()
public:
static void UpdateThresholds(const float fl,
const float fr,
const float bl,
const float br,
FOLSMovementDirectionThresholds& outMovementThresholds);
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)