Use NakatomiCMC to set Walk and Sprint speed

I am temporarily breaking ADS movement, this will be fixed in subsequent commits
This commit is contained in:
baz 2024-01-04 15:53:24 +00:00
parent af8d8364a4
commit ab3f624ade
1 changed files with 13 additions and 12 deletions

View File

@ -56,9 +56,8 @@ APlayerCharacter::APlayerCharacter(const FObjectInitializer& ObjectInitializer)
CameraADSSpringArmComponent->SocketOffset = {0.0f, 50.0f, 75.0f}; CameraADSSpringArmComponent->SocketOffset = {0.0f, 50.0f, 75.0f};
// Setup the character movement // Setup the character movement
UCharacterMovementComponent* CharacterMovementComponent = GetCharacterMovement(); GetCharacterMovement()->AirControl = 1.0f;
CharacterMovementComponent->AirControl = 1.0f; GetCharacterMovement()->bOrientRotationToMovement = true;
CharacterMovementComponent->bOrientRotationToMovement = true;
// Setup the character perception component // Setup the character perception component
PerceptionSource = CreateDefaultSubobject<UAIPerceptionStimuliSourceComponent>(TEXT("Perception Source Stimuli")); PerceptionSource = CreateDefaultSubobject<UAIPerceptionStimuliSourceComponent>(TEXT("Perception Source Stimuli"));
@ -269,16 +268,18 @@ void APlayerCharacter::QuitCallback(const FInputActionInstance& Instance)
void APlayerCharacter::SetSprintingCallback(const FInputActionInstance& Instance) void APlayerCharacter::SetSprintingCallback(const FInputActionInstance& Instance)
{ {
IsSpriting = true; if (NakatomiCMC)
{
SetMovementSpeed(); NakatomiCMC->EnableSprint();
}
} }
void APlayerCharacter::SetWalkingCallback(const FInputActionInstance& Instance) void APlayerCharacter::SetWalkingCallback(const FInputActionInstance& Instance)
{ {
IsSpriting = false; if (NakatomiCMC)
{
SetMovementSpeed(); NakatomiCMC->DisableSprint();
}
} }
void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits) void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
@ -450,7 +451,7 @@ void APlayerCharacter::OnDeath()
void APlayerCharacter::SetMovementSpeed() void APlayerCharacter::SetMovementSpeed()
{ {
if (IsADS) /*if (IsADS)
{ {
GetCharacterMovement()->MaxWalkSpeed = DefaultMovementSpeed * ADSSpeedMultiplier; GetCharacterMovement()->MaxWalkSpeed = DefaultMovementSpeed * ADSSpeedMultiplier;
} }
@ -461,7 +462,7 @@ void APlayerCharacter::SetMovementSpeed()
else else
{ {
GetCharacterMovement()->MaxWalkSpeed = DefaultMovementSpeed; GetCharacterMovement()->MaxWalkSpeed = DefaultMovementSpeed;
} }*/
} }
void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Instance) void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Instance)