Skip to content

Commit 2fa006d

Browse files
authored
fix jump boost limitation
1 parent bbd925f commit 2fa006d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/PBCharacterMovement/Private/Character/PBPlayerCharacter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void APBPlayerCharacter::OnJumped_Implementation()
228228
if (JumpBoost != 1)
229229
{
230230
// Only boost input in the direction of current movement axis.
231-
Input *= FMath::Max(Input.GetSafeNormal2D() | GetCharacterMovement()->Velocity.GetSafeNormal2D(), 0.0f);
231+
Input *= FMath::IsNearlyZero(Input.GetSafeNormal2D() | GetCharacterMovement()->Velocity.GetSafeNormal2D()) ? 0.0f : 1.0f;
232232
}
233233
const float ForwardSpeed = Input | Facing;
234234
// Adjust how much the boost is
@@ -247,7 +247,8 @@ void APBPlayerCharacter::OnJumped_Implementation()
247247
SpeedAddition -= NewSpeed - MaxBoostedSpeed;
248248
}
249249

250-
if (ForwardSpeed < -MovementPtr->GetMaxAcceleration() * FMath::Sin(0.6981f))
250+
const float AccelMagnitude = GetCharacterMovement()->GetCurrentAcceleration().Size2D();
251+
if (ForwardSpeed < -AccelMagnitude * FMath::Sin(0.6981f))
251252
{
252253
// Boost backwards if we're going backwards
253254
SpeedAddition *= -1.0f;

0 commit comments

Comments
 (0)