# Ledge Module

<figure><img src="/files/hJiaIVzYbdoa5VfeKq7J" alt=""><figcaption></figcaption></figure>

This system allows the player to:

* Detect climbable ledges
* Grab ledges while airborne
* Hang from ledges
* Move while hanging
* Climb onto platforms smoothly

The module is designed to create polished and responsive platforming movement.

***

## Component

```
LedgeModule
```

***

## Responsibilities

The Ledge Module controls:

* Ledge detection
* Hanging behavior
* Climb transitions
* Player positioning during ledge grab
* Movement while hanging
* Climb timing

It works together with:

* Rigidbody2D
* CollisionDetector
* PlayerInputHandler
* Wall Module

***

## Inspector Settings

## Ledge

### Is Enabled

Enables or disables the Ledge Module.

| Setting    | Description                         |
| ---------- | ----------------------------------- |
| Is Enabled | Enables ledge grabbing and climbing |

Useful for:

* Testing
* Mechanic customization
* Gameplay restrictions

***

## Hang Offset

Controls the player's position while hanging on a ledge.

| Axis | Description            |
| ---- | ---------------------- |
| X    | Horizontal hang offset |
| Y    | Vertical hang offset   |

This helps:

* Align the player correctly with ledges
* Improve visual positioning
* Match animations or sprites

Recommended starting values:

```
X = 0
Y = 0
```

Adjust depending on:

* Character size
* Sprite pivot
* Collider shape

***

## Ledge Grab Cooldown

Prevents the player from instantly grabbing a ledge again after releasing or climbing.

| Setting             | Description                                |
| ------------------- | ------------------------------------------ |
| Ledge Grab Cooldown | Delay before another ledge grab is allowed |

This helps:

* Prevent grab spam
* Avoid unstable ledge behavior
* Improve movement consistency

Recommended Range:

```
0.1 – 0.3
```

***

## Climb

<figure><img src="/files/vkpBbrFqTGf8XV85KBwO" alt="" width="447"><figcaption></figcaption></figure>

The Climb section controls how the player moves onto the platform after grabbing a ledge.

***

## Climb Offset

Controls the final position after completing a ledge climb.

| Axis | Description               |
| ---- | ------------------------- |
| X    | Horizontal climb position |
| Y    | Vertical climb position   |

This determines where the player ends up after climbing.

Example:

```
X = 1
Y = 2
```

Adjust these values depending on:

* Character size
* Platform height
* Collider dimensions

***

## Climb Delay

Adds a short delay before the climb movement begins.

| Setting     | Description                  |
| ----------- | ---------------------------- |
| Climb Delay | Delay before climbing starts |

This creates:

* Better game feel
* Cleaner animation timing
* Improved visual feedback

Recommended Range:

```
0.05 – 0.2
```

***

## Climb Speed

Controls how quickly the player moves during the climb.

| Setting     | Description          |
| ----------- | -------------------- |
| Climb Speed | Climb movement speed |

Higher values:

* Create faster transitions

Lower values:

* Create smoother cinematic movement

Recommended Range:

```
5 – 12
```

***

## Hang Movement

Hang Movement allows the player to move while hanging from a ledge.

This creates:

* More responsive ledge interaction
* Better movement control
* Advanced platforming flexibility

***

## Hang Move Speed

Controls movement speed while hanging.

| Setting         | Description                             |
| --------------- | --------------------------------------- |
| Hang Move Speed | Horizontal movement speed while hanging |

Higher values:

* Create faster ledge movement

Lower values:

* Create more precise control

Recommended Range:

```
6 – 14
```

***

## Recommended Settings

## Responsive Platformer

| Setting             | Value |
| ------------------- | ----- |
| Ledge Grab Cooldown | 0.2   |
| Climb Offset X      | 1     |
| Climb Offset Y      | 2     |
| Climb Delay         | 0.1   |
| Climb Speed         | 8     |
| Hang Move Speed     | 12    |

***

## Precision Platformer

| Setting             | Value |
| ------------------- | ----- |
| Ledge Grab Cooldown | 0.15  |
| Climb Offset X      | 1     |
| Climb Offset Y      | 2     |
| Climb Delay         | 0.05  |
| Climb Speed         | 10    |
| Hang Move Speed     | 8     |

***

## Dependencies

Required Components:

* Rigidbody2D
* CollisionDetector
* PlayerInputHandler
* Wall Module

Required Setup:

* LowerLedgeCheck Transform
* UpperLedgeCheck Transform
* Wall Layer

***

## Notes

* Proper ledge check placement is critical for reliable detection
* Climb Offset values may require adjustment depending on character size
* Ledge Grab Cooldown helps prevent unstable repeated grabs
* Climb Delay improves overall movement feel significantly

***

## Common Setup Tips

* Position LowerLedgeCheck near the player's chest
* Position UpperLedgeCheck slightly above the player's head
* Adjust Climb Offset carefully to avoid clipping into platforms
* Use moderate Climb Speed values for polished movement
* Combine with Wall Module for advanced platforming mechanics

***

## What's next?

{% content-ref url="/pages/dwFYNaCsnrZd6yObQ5VI" %}
[Movement Module](/pro-2d-controller-doc/core-module/movement-module.md)
{% endcontent-ref %}

{% content-ref url="/pages/Hk1xCtMVNoNuiJpCzKwm" %}
[Jump Module](/pro-2d-controller-doc/core-module/jump-module.md)
{% endcontent-ref %}

{% content-ref url="/pages/a3VkV5ZsLnOF8QKW1NaN" %}
[Dash Module](/pro-2d-controller-doc/core-module/dash-module.md)
{% endcontent-ref %}

{% content-ref url="/pages/kInZPCp4z8AXp1gru01o" %}
[Wall Module](/pro-2d-controller-doc/core-module/wall-module.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://the-code-cm.gitbook.io/pro-2d-controller-doc/core-module/ledge-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
