Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Monichev committed Sep 10, 2023
1 parent dbcec59 commit 438ec97
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Source/ALSV4_CPP/Private/Components/ALSMantleComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 438ec97

Please sign in to comment.