# Movement Module

This is the core movement system responsible for:

* Responsive horizontal movement
* Acceleration and deceleration
* Air control
* Slope movement
* Smooth physics-based movement

***

## Component

```
MovementModule
```

***

## Responsibilities

The Movement Module controls:

* Ground movement
* Air movement
* Slope movement direction
* Physics acceleration
* Velocity updates

It works together with:

* Rigidbody2D
* CollisionDetector
* PlayerInputHandler

***

## Inspector Settings

### Move Speed

Controls the player's maximum horizontal speed.

| Setting    | Description            |
| ---------- | ---------------------- |
| Move Speed | Maximum movement speed |

Higher values create faster movement.

Recommended Range:

```
5 – 10
```

***

## Smooth Movement

Enables physics-based acceleration and deceleration.

| Setting             | Description                         |
| ------------------- | ----------------------------------- |
| Use Smooth Movement | Enables acceleration-based movement |
| Acceleration        | Movement acceleration speed         |
| Deceleration        | Movement slowdown speed             |

When disabled, movement becomes instant.

***

## Acceleration

Controls how quickly the player reaches maximum speed.

Higher values:

* Feel more responsive
* Reach full speed faster

Lower values:

* Feel heavier
* Create smoother momentum

Recommended Range:

```
10 – 30
```

***

## Deceleration

Controls how quickly the player slows down after releasing movement input.

Higher values:

* Stop movement faster
* Feel more responsive

Lower values:

* Create slippery movement

Recommended Range:

```
10 – 30
```

***

## Air Control

Controls player movement while airborne.

| Setting                | Description                   |
| ---------------------- | ----------------------------- |
| Use Air Control        | Enables airborne movement     |
| Air Control Multiplier | Reduces air movement strength |

This helps create more controlled jumps.

Recommended Range:

```
0.4 – 0.8
```

***

## Slope Movement

<figure><img src="/files/u6MwVqQNFe3OKwEuy2yP" alt="" width="563"><figcaption></figcaption></figure>

The controller automatically adjusts movement direction using the ground normal.

This allows:

* Smooth slope traversal
* Natural grounded movement
* Better platforming feel

Supported Features:

* 45° slopes
* Steep slopes
* Stable grounded movement

***

## Smooth Movement vs Instant Movement

### Smooth Movement

Uses Rigidbody2D forces for movement.

Advantages:

* Natural acceleration
* Better momentum
* More physics-based feel

Best For:

* Cinematic platformers
* Momentum-heavy movement

***

### Instant Movement

Directly updates Rigidbody velocity.

Advantages:

* Extremely responsive
* Arcade-style controls
* Precise platforming

Best For:

* Precision platformers
* Fast-paced gameplay

***

## Recommended Settings

### Responsive Platformer

| Setting                | Value |
| ---------------------- | ----- |
| Move Speed             | 8     |
| Acceleration           | 12    |
| Deceleration           | 16    |
| Air Control Multiplier | 0.75  |

***

### Heavy Movement Style

| Setting                | Value |
| ---------------------- | ----- |
| Move Speed             | 5     |
| Acceleration           | 16    |
| Deceleration           | 20    |
| Air Control Multiplier | 0.6   |

***

## Dependencies

Required Components:

* Rigidbody2D
* PlayerInputHandler
* CollisionDetector

***

## Notes

* Smooth movement works best with Interpolate enabled on Rigidbody2D
* Continuous Collision Detection is recommended
* Proper ground check placement improves slope movement stability

***

## What's next?

{% 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 %}

{% content-ref url="/pages/A0dIPEOCcdKfsOKLI8cZ" %}
[Ledge Module](/pro-2d-controller-doc/core-module/ledge-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/movement-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.
