From 438ec972bbaa15cb2496d4ddb388b791e9e5695b Mon Sep 17 00:00:00 2001 From: Sergey Monichev Date: Sun, 10 Sep 2023 15:35:13 -0400 Subject: [PATCH] Fix #402 --- .../Private/Components/ALSMantleComponent.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/ALSV4_CPP/Private/Components/ALSMantleComponent.cpp b/Source/ALSV4_CPP/Private/Components/ALSMantleComponent.cpp index 607cc057..7cfcad2e 100644 --- a/Source/ALSV4_CPP/Private/Components/ALSMantleComponent.cpp +++ b/Source/ALSV4_CPP/Private/Components/ALSMantleComponent.cpp @@ -8,6 +8,7 @@ #include "Character/ALSCharacter.h" #include "Character/Animation/ALSCharacterAnimInstance.h" #include "Components/ALSDebugComponent.h" +#include "Components/CapsuleComponent.h" #include "Curves/CurveVector.h" #include "GameFramework/CharacterMovementComponent.h" #include "Kismet/KismetMathLibrary.h" @@ -279,6 +280,24 @@ bool UALSMantleComponent::MantleCheck(const FALSMantleTraceSettings& TraceSettin { MantleType = MantleHeight > 125.0f ? EALSMantleType::HighMantle : EALSMantleType::LowMantle; } + + // Step 4.1: Fix FallingCatch Mantle on low walls or objects + if (MantleType == EALSMantleType::FallingCatch) + { + FVector GroundTraceStart = CapsuleBaseLocation; + GroundTraceStart.Z = DownTraceLocation.Z; + FVector GroundTraceEnd = GroundTraceStart; + GroundTraceEnd.Z -= 70.0f; + + const float CapsuleRadius = OwnerCharacter->GetCapsuleComponent()->GetScaledCapsuleRadius(); + const FCollisionShape CapsuleCollisionShape = FCollisionShape::MakeCapsule(CapsuleRadius, CapsuleRadius); + const bool bHitGround = World->SweepSingleByProfile(HitResult, GroundTraceStart, GroundTraceEnd, FQuat::Identity, MantleObjectDetectionProfile, CapsuleCollisionShape, Params); + + if (bHitGround) + { + return false; + } + } // Step 5: If everything checks out, start the Mantle FALSComponentAndTransform MantleWS;