Course contentsShow
← Unreal Engine Game Development
Lesson 101 of 8802. The Gameplay FrameworkFree lesson

Implementing Character Jump and Air Control

You will leverage the built-in jump functionality to create responsive jumping mechanics and fine-tune air control for your character.

In this lesson, you will learn how to trigger the built-in jump functionality and refine how your character moves while airborne using the CharacterMovementComponent.

Leveraging the Jump Function

When using the ACharacter class, you don’t need to write manual physics code to move upward. The engine provides a built-in Jump() function that handles the impulse and state transitions automatically.

To implement this, you simply map your input (like the Spacebar) to call the Jump() function within your Character subclass. Conversely, you should call StopJumping() when the player releases the key; this allows the character to cut their jump short if the button is released early, creating a more responsive feel.

void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    // Bind jump to your input action
    PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
    PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);
}

Fine-Tuning Air Control

Once your character is in the air, you might notice they feel rigid or "floaty." The CharacterMovementComponent attached to your character controls this behavior via the AirControl property.

By default, AirControl is set to 0.0, meaning the player has no influence over their trajectory once they leave the ground. By increasing this value (typically between 0.05 and 0.3), you allow the player to steer the character horizontally while mid-jump.

Why Air Control Matters

  • Low Air Control: Makes jumping feel grounded and tactical, emphasizing the player's positioning before they leave the ground.
  • High Air Control: Makes jumping feel arcade-like and forgiving, allowing players to correct their landing spots mid-air.

You can modify this directly in the Character Blueprint’s Details panel under the CharacterMovement component settings, or in C++ via the constructor:

GetCharacterMovement()->AirControl = 0.2f;

By balancing the JumpZVelocity (which controls jump height) with your AirControl value, you can create a movement feel that matches the specific style of your game, whether it’s a tight platformer or a fast-paced shooter.

Key Takeaway: Use the built-in Jump() function for reliable movement states, and adjust the AirControl property on your CharacterMovementComponent to dictate how much influence players have over their mid-air trajectory.