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:
parent
af8d8364a4
commit
ab3f624ade
|
@ -25,7 +25,7 @@ APlayerCharacter::APlayerCharacter(const FObjectInitializer& ObjectInitializer)
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
PrimaryActorTick.SetTickFunctionEnable(true);
|
PrimaryActorTick.SetTickFunctionEnable(true);
|
||||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||||
|
|
||||||
//bUseControllerRotationPitch = true;
|
//bUseControllerRotationPitch = true;
|
||||||
//bUseControllerRotationYaw = true;
|
//bUseControllerRotationYaw = true;
|
||||||
//bUseControllerRotationRoll = false;
|
//bUseControllerRotationRoll = false;
|
||||||
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue