diff --git a/Source/ALS/Private/AlsCharacter.cpp b/Source/ALS/Private/AlsCharacter.cpp index da68dbd00..be201ee52 100644 --- a/Source/ALS/Private/AlsCharacter.cpp +++ b/Source/ALS/Private/AlsCharacter.cpp @@ -300,7 +300,7 @@ void AAlsCharacter::Tick(const float DeltaTime) RefreshGroundedRotation(DeltaTime); RefreshInAirRotation(DeltaTime); - StartMantlingInAir(); + if (Settings->Mantling.bAutoInAirMantling) StartMantlingInAir(); RefreshMantling(); RefreshRagdolling(DeltaTime); RefreshRolling(DeltaTime); diff --git a/Source/ALS/Public/AlsCharacter.h b/Source/ALS/Public/AlsCharacter.h index 68269fed5..1f8414e6c 100644 --- a/Source/ALS/Public/AlsCharacter.h +++ b/Source/ALS/Public/AlsCharacter.h @@ -502,9 +502,10 @@ class ALS_API AAlsCharacter : public ACharacter UFUNCTION(BlueprintCallable, Category = "ALS|Character", Meta = (ReturnDisplayName = "Success")) bool StartMantlingGrounded(); -private: + UFUNCTION(BlueprintCallable, Category = "ALS|Character", Meta = (ReturnDisplayName = "Success")) bool StartMantlingInAir(); +private: bool StartMantling(const FAlsMantlingTraceSettings& TraceSettings); UFUNCTION(Server, Reliable) diff --git a/Source/ALS/Public/Settings/AlsMantlingSettings.h b/Source/ALS/Public/Settings/AlsMantlingSettings.h index c73916ade..59281a169 100644 --- a/Source/ALS/Public/Settings/AlsMantlingSettings.h +++ b/Source/ALS/Public/Settings/AlsMantlingSettings.h @@ -106,6 +106,10 @@ struct ALS_API FAlsGeneralMantlingSettings UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ALS") uint8 bAllowMantling : 1 {true}; + // If true, the character will automatically try to mantle while in air. + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ALS") + uint8 bAutoInAirMantling: 1 {true}; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ALS", Meta = (ClampMin = 0, ClampMax = 180, ForceUnits = "deg")) float TraceAngleThreshold{110.0f}; diff --git a/Source/ALSExtras/Private/AlsCharacterExample.cpp b/Source/ALSExtras/Private/AlsCharacterExample.cpp index a996cad8f..78226b1bb 100644 --- a/Source/ALSExtras/Private/AlsCharacterExample.cpp +++ b/Source/ALSExtras/Private/AlsCharacterExample.cpp @@ -5,6 +5,7 @@ #include "EnhancedInputSubsystems.h" #include "Engine/LocalPlayer.h" #include "GameFramework/PlayerController.h" +#include "Settings/AlsCharacterSettings.h" #include "Utility/AlsVector.h" #include UE_INLINE_GENERATED_CPP_BY_NAME(AlsCharacterExample) @@ -162,6 +163,11 @@ void AAlsCharacterExample::Input_OnJump(const FInputActionValue& ActionValue) return; } + if (!Settings->Mantling.bAutoInAirMantling && LocomotionMode == AlsLocomotionModeTags::InAir && StartMantlingInAir()) + { + return; + } + if (StartMantlingGrounded()) { return;