Skip to content

Commit

Permalink
Merge pull request #4 from Monichev/issues/402
Browse files Browse the repository at this point in the history
  • Loading branch information
Monichev authored Sep 10, 2023
2 parents 14c136e + 438ec97 commit a38de86
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 a38de86

Please sign in to comment.