# Player setup

***

## Recommended Player Hierarchy

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

A clean hierarchy helps keep the controller organized and easy to customize.

Recommended structure:

```
Player
├── GroundChecks
│   ├── LeftGroundCheck
│   ├── CenterGroundCheck
│   └── RightGroundCheck
├── WallCheck
├── LowerLedgeCheck
└── UpperLedgeCheck
```

***

## Required Components

The following components are required for the controller to function correctly:

| Component          | Purpose                           |
| ------------------ | --------------------------------- |
| PlayerController   | Core script                       |
| Rigidbody2D        | Handles physics movement          |
| PlayerInputHandler | Reads player input                |
| CollisionDetector  | Ground, wall, and ledge detection |
| MovementModule     | Core horizontal movement          |
| JumpModule         | Jump handling                     |

Optional modules can be added depending on your project requirements.

***

## Rigidbody2D Settings

Recommended Rigidbody2D settings:

| Setting             | Value       |
| ------------------- | ----------- |
| Body Type           | Dynamic     |
| Gravity Scale       | 2.5 to 3    |
| Collision Detection | Continuous  |
| Interpolate         | Interpolate |
| Freeze Rotation Z   | Enabled     |

These settings help improve movement smoothness and collision stability.

***

## Ground Checks (Collision Detection)

<figure><img src="/files/ny3rlAw76TyFDlbGEcqo" alt="" width="378"><figcaption></figcaption></figure>

The controller uses three ground checks for reliable slope and ground detection.

Required transforms:

* LeftGroundCheck
* CenterGroundCheck
* RightGroundCheck

Position the checks bottom of the player's feet.

This setup helps:

* Improve slope detection
* Prevent edge detection issues
* Create more stable grounded checks

***

## Wall Check (Collision Detection)

<figure><img src="/files/RuqrJQXPp8lYJLcWzqlN" alt="" width="324"><figcaption></figcaption></figure>

The WallCheck transform is used for:

* Wall detection
* Wall slide
* Wall jump

Position the WallCheck around the chest height.

This transform is only required when using the Wall Module.

***

## Ledge Checks (Collision Detection)

<figure><img src="/files/jCvxhYYWeLUDSLZpQYYJ" alt="" width="386"><figcaption></figcaption></figure>

The ledge system uses two transforms:

* LowerLedgeCheck
* UpperLedgeCheck

These are used to detect ledge climb opportunities.

Recommended placement:

* LowerLedgeCheck near the player's chest
* UpperLedgeCheck around the player's head

These transforms are only required when using the Ledge Module.

***

## Layers

Recommended layers:

| Layer  | Purpose                |
| ------ | ---------------------- |
| Ground | Ground collision       |
| Wall   | Wall & ledge detection |

Assign the layers inside the CollisionDetector component.

***

## Setup Validation

The custom inspector includes a built-in validation system that automatically checks:

* Missing components
* Missing transforms
* Ground checks
* Wall checks
* Ledge checks
* Layer assignments

If setup is configured correctly, the inspector will display:

```
Controller setup validation completed successfully.
```

***

## Optional Modules

Additional systems can be added directly from the custom inspector:

* Dash Module
* Wall Module
* Ledge Module
* Debug Module

This modular approach allows you to create lightweight or advanced controllers depending on your project needs.

***

## Recommended Workflow

1. Add the required core components
2. Configure Rigidbody2D settings
3. Assign ground and wall checks
4. Configure layers
5. Add optional modules
6. Test inside Play Mode

## What's next?

{% content-ref url="/pages/vtW33hJZ9F7oZMXEqthx" %}
[Collision Detector](/pro-2d-controller-doc/getting-started/collision-detector.md)
{% endcontent-ref %}

{% content-ref url="/pages/ytgu4tH8eZr1V9qiDtZs" %}
[FAQ & Troubleshooting](/pro-2d-controller-doc/getting-started/faq-and-troubleshooting.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/getting-started/player-setup.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.
