From ab3f624ade7fe7e0072f0f35854fc4eca89d87f6 Mon Sep 17 00:00:00 2001 From: baz Date: Thu, 4 Jan 2024 15:53:24 +0000 Subject: [PATCH] Use NakatomiCMC to set Walk and Sprint speed I am temporarily breaking ADS movement, this will be fixed in subsequent commits --- Source/Nakatomi/PlayerCharacter.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 5e8e4fb..ba09290 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -25,7 +25,7 @@ APlayerCharacter::APlayerCharacter(const FObjectInitializer& ObjectInitializer) PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.SetTickFunctionEnable(true); PrimaryActorTick.bStartWithTickEnabled = true; - + //bUseControllerRotationPitch = true; //bUseControllerRotationYaw = true; //bUseControllerRotationRoll = false; @@ -56,9 +56,8 @@ APlayerCharacter::APlayerCharacter(const FObjectInitializer& ObjectInitializer) CameraADSSpringArmComponent->SocketOffset = {0.0f, 50.0f, 75.0f}; // Setup the character movement - UCharacterMovementComponent* CharacterMovementComponent = GetCharacterMovement(); - CharacterMovementComponent->AirControl = 1.0f; - CharacterMovementComponent->bOrientRotationToMovement = true; + GetCharacterMovement()->AirControl = 1.0f; + GetCharacterMovement()->bOrientRotationToMovement = true; // Setup the character perception component PerceptionSource = CreateDefaultSubobject(TEXT("Perception Source Stimuli")); @@ -269,16 +268,18 @@ void APlayerCharacter::QuitCallback(const FInputActionInstance& Instance) void APlayerCharacter::SetSprintingCallback(const FInputActionInstance& Instance) { - IsSpriting = true; - - SetMovementSpeed(); + if (NakatomiCMC) + { + NakatomiCMC->EnableSprint(); + } } void APlayerCharacter::SetWalkingCallback(const FInputActionInstance& Instance) { - IsSpriting = false; - - SetMovementSpeed(); + if (NakatomiCMC) + { + NakatomiCMC->DisableSprint(); + } } void APlayerCharacter::CalculateHits(TArray* hits) @@ -450,7 +451,7 @@ void APlayerCharacter::OnDeath() void APlayerCharacter::SetMovementSpeed() { - if (IsADS) + /*if (IsADS) { GetCharacterMovement()->MaxWalkSpeed = DefaultMovementSpeed * ADSSpeedMultiplier; } @@ -461,7 +462,7 @@ void APlayerCharacter::SetMovementSpeed() else { GetCharacterMovement()->MaxWalkSpeed = DefaultMovementSpeed; - } + }*/ } void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Instance)