Merge movement-component #1

Merged
baz merged 20 commits from movement-component into master 2024-01-18 18:30:17 +01:00
1 changed files with 13 additions and 12 deletions
Showing only changes of commit ab3f624ade - Show all commits

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)