Hey guys, I made a sprinting system that will only increase forward momentum. But this was done through modifying the value of AddMovementInput’s scale input. During my testing i realized that even with a hard-coded value in place, the scale input of AddMovementInput() is just ignored. Same goes for BP. Can someone tell me whats going on? Or I just have to make my own pawn? Answers pls
Here is the corresponding code:
// Handles relative X axis movement
void ADHCharacter::MoveForward(float Value)
{
if (IsAcceptingInput() && Value != 0.0f)
{
bIsMoving = true;
// Get control rotation
FRotator Rotation = Controller->GetControlRotation();
// Zero out pitch and roll
Rotation.Roll, Rotation.Pitch = 0.0f;
// Cache direction
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
// Add movement to direction
if (bIsSprinting) AddMovementInput(Direction, Value + (AdditiveSprintingSpeed / WalkingSpeed));
else AddMovementInput(Direction, Value);
bIsMovingForward = Value > 0.0f;
}
else if (IsAcceptingInput())
{
bIsMoving = false;
bIsMovingForward = false;
}
}