Implemented basic footsteps

This commit is contained in:
TjgL 2025-04-16 22:43:37 +02:00
parent e862d22f5f
commit da00261121
5 changed files with 18 additions and 2 deletions

BIN
Content/Legumix/Player/BP_Play.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -157,6 +157,7 @@ void ULMMovementComponent::EnterSlide()
bWantsToCrouch = true;
Velocity += Velocity.GetSafeNormal2D() * SlideEnterImpulse;
SetMovementMode(EMovementMode::MOVE_Custom, ECustomMovementModes::ECMM_Sliding);
OnSlideStarted.Broadcast();
}
void ULMMovementComponent::ExitSlide()
@ -167,6 +168,7 @@ void ULMMovementComponent::ExitSlide()
FHitResult Hit;
SafeMoveUpdatedComponent(FVector::ZeroVector, NewRotation, true, Hit);
SetMovementMode(EMovementMode::MOVE_Walking);
OnSlideEnded.Broadcast();
}
void ULMMovementComponent::PhysSlide(float DeltaTime, int32 Iterations)

View File

@ -308,6 +308,7 @@ void ALMPlayer::DoLedgeGrabCheck()
FVector TeleportLocation = FVector(Hit.Location.X, Hit.Location.Y, Hit.Location.Z + GetCapsuleComponent()->GetScaledCapsuleHalfHeight());
SetActorLocation(TeleportLocation, false, nullptr, ETeleportType::ResetPhysics);
OnLedgeGrab();
}
}

View File

@ -10,6 +10,11 @@
class ALMPlayer;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnSlideStartedSignature);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnSlideEndedSignature);
// See https://www.youtube.com/playlist?list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class LEGUMEMIX_API ULMMovementComponent : public UCharacterMovementComponent
@ -71,6 +76,11 @@ public:
UFUNCTION(BlueprintCallable, Category="Legumix|Slide")
void CrouchToggle(bool Toggle);
UPROPERTY(BlueprintAssignable, Category=Legumix)
FOnSlideStartedSignature OnSlideStarted;
UPROPERTY(BlueprintAssignable, Category=Legumix)
FOnSlideEndedSignature OnSlideEnded;
public:
UPROPERTY(Transient)
TObjectPtr<ALMPlayer> PlayerCharacterOwner;

View File

@ -111,6 +111,9 @@ public:
UFUNCTION()
void MovementChanged(ACharacter* Character, EMovementMode PrevMovementMode, uint8 PreviousCustomMode);
UFUNCTION(BlueprintImplementableEvent, Category=Legumix)
void OnLedgeGrab();
UFUNCTION(BlueprintCallable)
void DoLedgeGrabCheck();