Build a Parkour System: Wall Running, Jumping, and Vaulting

Posted by Gemma Ellison
./
July 9, 2025

Forget walking! Forget gravity! Let’s build some freaking parkour mechanics. This isn’t just about jumping higher; it’s about manipulating the game world, bending it to your will, and traversing it with style. We’re ditching the hand-holding tutorial and jumping straight into the code, building a system that’s both functional and FUN. Even if you’ve never written a line of game code before, buckle up. This is your gateway to defying physics, one wall run at a time.

Setting the Stage: Basic Movement

Before we can channel our inner ninja, we need a basic character controller. I’m assuming you have a simple movement script already – something that lets your character walk and jump. If not, there are countless tutorials online for basic character movement in Unity (using CharacterController) or Unreal Engine (using CharacterMovementComponent). Nail that down first.

Don’t fall into the trap of over-complicating your initial movement. Focus on a solid foundation before adding fancy features. A common mistake is trying to implement everything at once. Start with the basics, and then incrementally add parkour elements.

Wall Running: Defying Gravity

Wall running is where things get interesting. The core idea is to detect a wall, latch onto it, and move along it.

Here’s the opinionated take: Forget complex animation blending at first. Get the core mechanic working. A simple upward force and forward movement is enough to start. Polish comes later.

Step 1: Wall Detection.

Use a Raycast to detect walls in front of the character. This casts a ray from your character, and if it hits something, it gives you information about the hit object.

// C# - Unity Example
RaycastHit hit;
if (Physics.Raycast(transform.position, transform.forward, out hit, wallRunDistance)) {
    if (hit.collider.CompareTag("Wall")) {
        // We hit a wall!
        isWallRunning = true;
        wallNormal = hit.normal; // Store the wall's normal for later use
    }
} else {
    isWallRunning = false;
}

Step 2: Apply Forces.

While isWallRunning is true, apply an upward force and a force along the wall.

// C# - Unity Example
if (isWallRunning) {
    // Apply upward force to counteract gravity
    rb.AddForce(Vector3.up * wallRunGravity, ForceMode.Force);

    // Calculate the direction to run along the wall
    Vector3 wallRunDirection = Vector3.Cross(wallNormal, Vector3.up);
    if (Vector3.Dot(wallRunDirection, transform.forward) < 0) {
        wallRunDirection = -wallRunDirection; // Ensure correct direction
    }

    // Apply force along the wall
    rb.AddForce(wallRunDirection * wallRunSpeed, ForceMode.Force);
}

Pitfalls:

  • Sticking to the Wall: If your character gets “stuck” to the wall, it’s likely the Raycast is continuously hitting the wall even when you want to jump off. Implement a timer to prevent wall running immediately after jumping off a wall.
  • Disorientation: Wall running can be disorienting. Gradually rotate the camera to align with the wall for a smoother experience.

Jumping: The Foundation of Freedom

Jumping seems simple, but nailing the feel is crucial. Ditch the default Unity jump; let’s build something snappier.

Step 1: Ground Detection.

Reliable ground detection is vital. Use a Raycast pointing downwards.

Step 2: Apply Impulse.

Instead of applying a continuous force, use an impulse to instantly propel the character upwards.

// C# - Unity Example
if (Input.GetButtonDown("Jump") && isGrounded) {
    rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
    isGrounded = false; // Prevent immediate re-jumping
}

Fine Tuning:

  • Coyote Time: Allow a small window after leaving the ground where the player can still jump. This makes jumps feel more forgiving.
  • Variable Jump Height: Adjust jump height based on how long the jump button is held.

Vaulting: Graceful Obstacle Navigation

Vaulting allows your character to gracefully overcome obstacles. This is often the most complex mechanic to implement.

Step 1: Obstacle Detection.

Cast a Raycast forward to detect obstacles within vaulting range.

Step 2: Determine Vault Type.

Based on the height of the obstacle, choose a vault animation (e.g., a low vault over a short wall, a high vault over a taller one). This is often skipped for simplicity but adds a lot to the feel.

Step 3: Animation and Movement.

Trigger the vault animation and smoothly move the character over the obstacle. Don’t just teleport!

// C# - Unity Example (Simplified)
if (Physics.Raycast(transform.position, transform.forward, out hit, vaultDistance)) {
    if (hit.collider.CompareTag("Vaultable")) {
        StartCoroutine(Vault(hit.transform.position));
    }
}

IEnumerator Vault(Vector3 targetPosition) {
    // Disable player control during the vault
    canMove = false;

    float elapsedTime = 0;
    Vector3 startingPosition = transform.position;

    while (elapsedTime < vaultDuration) {
        transform.position = Vector3.Lerp(startingPosition, targetPosition + vaultOffset, (elapsedTime / vaultDuration));
        elapsedTime += Time.deltaTime;
        yield return null;
    }

    // Re-enable player control
    canMove = true;
}

Challenges:

  • Animation Synchronization: Ensuring the animation perfectly matches the character’s movement is tricky. Use root motion to drive the character’s position from the animation.
  • Edge Cases: Vaulting near corners or uneven surfaces can lead to unexpected behavior. Add additional Raycasts to detect these situations and adjust the vault accordingly.

The Iterative Approach: Build, Test, Refine

The biggest mistake developers make is trying to perfect each mechanic in isolation. Instead, build a basic version of all three mechanics, then iterate. Playtest frequently, get feedback, and refine based on what feels good. Don’t be afraid to completely scrap and rewrite a mechanic if it’s not working. Your initial code is just a starting point, not a sacred artifact.

Finally, remember that polish is key. Subtle tweaks to animation timings, camera movement, and particle effects can make a huge difference in how the game feels.

Now go, defy gravity. Make something awesome.