Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #402 #461

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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