Skip to main content

Runtime Components

This section describes the main runtime components of the Ledge System and how they interact.

These components are fully functional out of the box, but are designed to be modular and extensible.


Ledge Agent Data

LedgeAgentData is a ScriptableObject that defines all configuration required for ledge interaction.

It includes:

  • Movement timings
  • Position offsets
  • Behavior tuning parameters

Take time to review this asset, as it controls most runtime behavior.


Ledge Agent

LedgeAgent is the main MonoBehaviour responsible for interacting with the core system.

It communicates with the LedgeHandler and acts as the bridge between detection, movement, and animation systems.

Responsibilities

  • Receiving CharacterLedge data from the system
  • Controlling the player state while on a ledge
  • Managing transitions (grab, move, drop, climb)
  • Providing data for IK systems

Setup

Add the following components to your player:

  • LedgeAgent
  • LedgeAutoMovementHandler
  • PlayerLedgeMoveRequestProcessor (or your own ILedgeMoveRequestProcessor implementation)

Assign:

  • LedgeAgentData
  • LedgeDetectionData

Important: Incorrect data setup is the most common cause of issues.


Ledge Movement

The system is modular. Each movement type is implemented as a separate component.

The provided SampleCharacter supports:

  • Ledge detection
  • Moving sideways
  • Jumping away
  • Climbing up
  • Dropping

Each behavior can be replaced or extended.


Movement Architecture

  • Each movement type inherits from BaseLedgeMovement
  • Each movement defines its own execution conditions
  • Movement components are attached to the player

In the sample setup, these are organized as child prefabs:

Movement Setup


Ledge Detection

The system uses a two-ray approach to identify valid ledges.

Ray Setup

  • Upper Ray (Miss Check)
  • Lower Ray (Hit Check)

Detection Rule

A ledge is detected when:

  • Upper ray does not hit the Grab Layer
  • Lower ray does hit the Grab Layer

This produces a valid candidate for the LedgeHandler.


Ledge Data

The system calculates a CharacterLedge, which includes:

  • Position
  • Normal
  • Direction

Each value is calculated for:

  • Center
  • Left
  • Right

Ledge Properties


Moving Along a Ledge

When moving sideways:

  1. LedgeHandler.TryMoveToSide calculates a new ledge
  2. LedgeAgent moves the player to the new position
  3. Movement data is generated for animation and IK systems

This ensures smooth transitions across complex geometry.


IK Integration (Advanced)

The system provides movement data through MoveRequest objects.

Each request includes:

  • Start position/rotation
  • Target position/rotation

These are passed to an ILedgeMoveRequestProcessor, which can drive:

  • IK systems
  • Custom animation systems

You can fully replace this layer depending on your animation setup.


We will skip explaining all the movements in this system since they can become overwhelming, let us know if you want us to dive deeper into these classes and systems

Next Steps

  • Explore Examples to see full implementations