> 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/health-and-stamina-module.md).

# Health & Stamina Module

Health, stamina, and the sprint-gating that ties them together.

## Inspector reference

### Health Settings

| Field                  | Type  | Default | What it does                                    |
| ---------------------- | ----- | ------- | ----------------------------------------------- |
| **Current Health**     | float | `100`   | Live health readout *(read-only)*.              |
| **Max Health**         | float | `100`   | Maximum health.                                 |
| **Infinite Health**    | bool  | `false` | Health never decreases.                         |
| **Health Regen Delay** | float | `3`     | Seconds after damage before health regenerates. |
| **Health Regen Rate**  | float | `5`     | Health restored per second while regenerating.  |

### Fall Damage

| Field                           | Type  | Default | What it does                                           |
| ------------------------------- | ----- | ------- | ------------------------------------------------------ |
| **Enable Fall Damage**          | bool  | `true`  | Turns fall damage on.                                  |
| **Fall Damage Min Distance**    | float | `4`     | Minimum fall (m) before any damage applies.            |
| **Fall Damage Per Meter**       | float | `5`     | Damage per meter beyond the minimum.                   |
| **Max Fall Damage**             | float | `80`    | Cap on a single landing's damage (prevents one-shots). |
| **Instant Death Fall Distance** | float | `20`    | Fall distance (m) that guarantees death.               |

### Spawn Settings

| Field            | Type         | What it does                                                |
| ---------------- | ------------ | ----------------------------------------------------------- |
| **Spawn Points** | Transform\[] | Respawn locations; the nearest to the death spot is chosen. |

### Stamina Settings

| Field                   | Type  | Default | What it does                             |
| ----------------------- | ----- | ------- | ---------------------------------------- |
| **Max Stamina**         | float | `100`   | Maximum stamina.                         |
| **Infinite Stamina**    | bool  | `false` | Stamina never decreases.                 |
| **Sprint Stamina Cost** | float | `15`    | Stamina drained per second of sprinting. |
| **Jump Stamina Cost**   | float | `20`    | Stamina drained per jump.                |
| **Stamina Regen Rate**  | float | `10`    | Stamina restored per second.             |
| **Stamina Regen Delay** | float | `1`     | Delay before stamina regenerates.        |

### Death Settings

| Field                        | Type | Default | What it does                                               |
| ---------------------------- | ---- | ------- | ---------------------------------------------------------- |
| **Trigger Ragdoll On Death** | bool | `true`  | Find and trigger a Ragdoll module when the character dies. |

### Events

| Field                   | Type       | Fires when             |
| ----------------------- | ---------- | ---------------------- |
| **On Death**            | UnityEvent | Health reaches zero.   |
| **On Take Damage**      | UnityEvent | Any damage is applied. |
| **On Heal**             | UnityEvent | Health is restored.    |
| **On Stamina Depleted** | UnityEvent | Stamina hits zero.     |

***

A player-driven module (on the Controller) tracking the character's vitals. Beyond storing numbers, it *gates* abilities — most visibly, whether the character is allowed to sprint.

### The sprint seam

The controller implements `ILocomotionDriver`, and its `CanSprint` simply asks the health module:

```csharp
public bool CanSprint => health != null && health.CanSprint;
```

Locomotion checks `CanSprint` before letting the character sprint, so when stamina runs out, sprinting stops — without locomotion knowing anything about stamina. Swap the health module for your own and sprint-gating still works, as long as you honour the interface.

### Damage and death

Health also implements the base-package damage interface `IDamageableHealth` (declared in the `Rigonix` namespace so the base ships without any melee dependency). When health reaches zero it drives the death flow — the animator's death state and, where set up, the ragdoll collapse.

{% hint style="info" %}
Because `IDamageableHealth` lives in the core namespace, add-ons like melee can deal damage to a base character through the interface without the base package ever referencing the add-on. That's the boundary working as intended.
{% endhint %}


---

# 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/health-and-stamina-module.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.
