Hey! I am trying to program a simple dodge (similar to the Unreal Tournament one), but for some reason, the player jumps a lot further when the “DodgeBwd” is called. Anyone know why? It doesnt make any sense to me…thank you in advance!
InputComponent->BindAction("Forwards", IE_DoubleClick, this, &AFPSCharacter::DodgeFwd);
InputComponent->BindAction("Backwards", IE_DoubleClick, this, &AFPSCharacter::DodgeBwd);
void AFPSCharacter::DodgeFwd()
{
const FVector ForwardDir = FirstPersonCameraComponent->GetForwardVector();
const FVector AddForce = (ForwardDir * plDodgeDist) + FVector(0, 0, 1) * (plDodgeVelocity);
if (CharacterMovement->IsMovingOnGround())
{
LaunchCharacter(AddForce, true, true);
}
if (plMomentum > 0)
{
plMomentum = 0;
}
}
void AFPSCharacter::DodgeBwd()
{
const FVector ForwardDir = FirstPersonCameraComponent->GetForwardVector();
const FVector AddForce = (ForwardDir * (0 - plDodgeDist)) + FVector(0, 0, 1) * (plDodgeVelocity);
if (CharacterMovement->IsMovingOnGround())
{
LaunchCharacter(AddForce, true, true);
}
if (plMomentum > 0)
{
plMomentum = 0;
}
}