> For the complete documentation index, see [llms.txt](https://rigonix3d.gitbook.io/rigonix3d-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rigonix3d.gitbook.io/rigonix3d-docs/documentation/the-modules/markdown.md).

# Input Module

The single source of truth for what the character wants to do this frame.

## Inspector reference

### General Settings

| Field              | Type | Default              | What it does                                                                                                                        |
| ------------------ | ---- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| **Control Scheme** | enum | `KeyboardMouse`      | Chooses between `KeyboardMouse` and `Mobile` on-screen controls.                                                                    |
| **Input Backend**  | enum | `LegacyInputManager` | Which Unity input system to read from — legacy Input Manager or the new Input System. Switches which binding cards below are shown. |
| **Input Blocked**  | bool | `false`              | When on, freezes all intent this frame (movement, look, actions) without disabling the component — handy for cutscenes and menus.   |
| **Lock Cursor**    | bool | `true`               | Locks and hides the hardware cursor for gameplay.                                                                                   |

### Keyboard Bindings *(shown when backend = Legacy Input Manager)*

Each row is the `KeyCode` for one action. Defaults shown.

| Field                 | Default      | Action             |
| --------------------- | ------------ | ------------------ |
| **Sprint Key**        | Left Shift   | Sprint             |
| **Crouch Key**        | C            | Toggle crouch      |
| **Prone Key**         | Z            | Toggle prone       |
| **Roll Key**          | Q            | Roll dodge         |
| **Slide Key**         | T            | Slide              |
| **Dynamic Dodge Key** | Q            | Context dodge      |
| **Emote Menu Key**    | B            | Open emote menu    |
| **Jump Key**          | Space        | Jump               |
| **Aim Key**           | Mouse1 (RMB) | Aim                |
| **Interact Key**      | E            | Interact           |
| **Use Item Key**      | E            | Use equipped item  |
| **Drop Item Key**     | G            | Drop equipped item |
| **Teleport Key**      | U            | Blink/teleport     |

### Gamepad Bindings *(shown when backend = Legacy Input Manager)*

| Field                                  | Default                | What it does                                                 |
| -------------------------------------- | ---------------------- | ------------------------------------------------------------ |
| **Gamepad Dead Zone**                  | `0.15`                 | Stick magnitude below this is treated as zero (kills drift). |
| **Gp Jump / Sprint / Crouch / Prone**  | A, L3, B, D-Pad Down   | Face/stick/d-pad buttons for those actions.                  |
| **Gp Roll / Slide / Dynamic Dodge**    | R1, L1, R1             | Dodge-family buttons.                                        |
| **Gp Emote Menu**                      | D-Pad Up               | Opens the emote menu.                                        |
| **Gp Interact / Use Item / Drop Item** | X, X, D-Pad Down       | World and item actions.                                      |
| **Gp Teleport**                        | Y (Triangle)           | Blink/teleport.                                              |
| **Gp Inventory Next / Prev**           | D-Pad Right / Left     | Cycle equipped item.                                         |
| **Gp Aim Axis**                        | `6th axis (Joysticks)` | The trigger axis used for aim (LT on most pads).             |
| **Gp Aim Axis Threshold**              | `0.5`                  | How far the trigger must travel to count as aiming.          |
| **Gp Primary Action**                  | R1                     | Primary action button (used by add-ons).                     |

### New Input System *(shown when backend = New Input System)*

| Field             | Type               | What it does                                                                                           |
| ----------------- | ------------------ | ------------------------------------------------------------------------------------------------------ |
| **Input Actions** | `InputActionAsset` | Your action asset. Leave empty and Rigonix builds a default keyboard + mouse + gamepad map at runtime. |

### Debug *(read-only runtime state)*

The press flags shown here — `wasCrouchedPressed`, `wasPronePressed`, `wasRollPressed`, `wasDivePressed`, `wasSlidePressed`, `wasJumpPressed` — are read-only readouts so you can watch input fire in play mode. All other intent fields are hidden.

***

The **Input module** is the character's *intent surface*. Every frame it collects what the player wants — move here, look there, jump, crouch, aim — and writes it into plain fields that every other module reads. It lives on the Core so that an AI can write the very same fields without any hardware involved.

{% hint style="info" %}
**This is the most important architectural rule in Rigonix.** Modules never poll hardware themselves. They read `controller.input.*`. The Input module is the *only* place raw devices are touched, and it runs first in the update order so everyone downstream sees fresh values.
{% endhint %}

### The intent fields

These are the fields the rest of the controller consumes:

| Field                                                                                        | Meaning                       |
| -------------------------------------------------------------------------------------------- | ----------------------------- |
| `movementInput`                                                                              | Raw stick/WASD vector.        |
| `lookInput`                                                                                  | Mouse / right-stick delta.    |
| `inputDir`                                                                                   | Processed movement direction. |
| `isSprinting`, `isCroucing`, `isProning`, `isAiming`                                         | Held stance/aim flags.        |
| `wasJumpPressed`, `wasRollPressed`, `wasDivePressed`, `wasSlidePressed`                      | One-frame action edges.       |
| `wasInteractPressed`, `isInteractHeld`                                                       | Interaction taps and holds.   |
| `wasUseItemPressed`, `wasDropItemPressed`, `wasInventoryNextPressed`, `inventoryScrollDelta` | Inventory actions.            |
| `wasTeleportPressed`, `emoteMenuTriggered`, `dynamicDodgeTriggered`                          | Ability triggers.             |

A reading module just checks the flag it cares about:

```csharp
if (controller.input.wasJumpPressed) { /* jump */ }
```

### Device support

Input handles keyboard, mouse, gamepad, and touch simultaneously. Gamepad sticks and buttons are read through the legacy Input Manager and **OR'd onto** the keyboard state, so both devices are live at once with no mode switch. A `gamepadDeadZone` filters stick drift.

### Works with either input backend

Rigonix compiles against both Unity input systems. It uses the `#if ENABLE_INPUT_SYSTEM` pattern throughout, and when the new Input System is active it builds a runtime `InputActionMap` with sensible keyboard + mouse + gamepad defaults — which you can override by assigning your own `InputActionAsset` in the inspector. On the legacy side, a `GetAxisSafe` wrapper returns `0` instead of throwing when an axis hasn't been defined in the Input Manager, so a missing binding never spams your console.

### Cursor control

```csharp
controller.input.LockCursor();    // gameplay: hide + lock to center
controller.input.UnlockCursor();  // menus: show + free
```

`lockCursor` starts true, and `inputBlocked` lets you freeze all intent (during a cutscene, say) without disabling the component.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://rigonix3d.gitbook.io/rigonix3d-docs/documentation/the-modules/markdown.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
