> 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/camera-module.md).

# Camera Module

The third-person camera rig, and how it reacts to stance and aim.

## Inspector reference

The camera lives on its own component, `rCameraController`, not on the character. Its fields:

### Target & Follow

| Field             | Type      | Default     | What it does                                  |
| ----------------- | --------- | ----------- | --------------------------------------------- |
| **Target**        | Transform | —           | The character root the camera follows.        |
| **Follow Speed**  | float     | `120`       | How quickly the rig catches up to the target. |
| **Follow Offset** | Vector3   | `(0, 2, 0)` | Height/position offset from the target pivot. |

### Camera States

Each state is a `CameraStateSettings` bundle with four values — **Offset** (Vector3), **Distance** (float), **FOV** (float), and **Collision Smooth Time** (float):

| Field               | What it frames              |
| ------------------- | --------------------------- |
| **Normal State**    | Default standing view.      |
| **Crouch State**    | Framing while crouched.     |
| **Prone State**     | Framing while prone.        |
| **Aim State**       | Over-the-shoulder aim view. |
| **Prone Aim State** | Aim framing while prone.    |
| **Sprint State**    | Pulled-back sprint view.    |

### Transition

| Field                                | Type  | Default | What it does                              |
| ------------------------------------ | ----- | ------- | ----------------------------------------- |
| **State Transition Speed**           | float | `8`     | How fast offsets blend between states.    |
| **Camera Distance Transition Speed** | float | `4`     | How fast distance blends.                 |
| **FOV Transition Speed**             | float | `5`     | How fast field-of-view blends.            |
| **Sprint Effect Distance Increase**  | float | `1.5`   | Extra pull-back distance while sprinting. |

### Rotation Settings

| Field                        | Type  | Default     | What it does                                 |
| ---------------------------- | ----- | ----------- | -------------------------------------------- |
| **Input Sensitivity**        | float | `150`       | Mouse/right-stick look speed.                |
| **Mobile Input Sensitivity** | float | `45`        | Look speed for touch swipe.                  |
| **Clamp Angle Up / Down**    | float | `70` / `30` | How far the camera can pitch up and down.    |
| **Rotation Smooth Speed**    | float | `10`        | Look smoothing — 0 instant, higher smoother. |

### Aim Settings

| Field                    | Type    | Default         | What it does                    |
| ------------------------ | ------- | --------------- | ------------------------------- |
| **Aim Camera Distance**  | float   | `2.0`           | Camera distance while aiming.   |
| **Aim Transition Speed** | float   | `10`            | How fast the aim view snaps in. |
| **Aim Position Offset**  | Vector3 | `(0.5, 0.2, 0)` | Shoulder offset while aiming.   |

### Prone Aim & Advanced

| Field                               | Type  | Default | What it does                                               |
| ----------------------------------- | ----- | ------- | ---------------------------------------------------------- |
| **Prone Aim Moving Distance**       | float | `2.5`   | Camera pulls back slightly when moving while prone-aiming. |
| **Prone Aim Moving Blend Speed**    | float | `4`     | How fast that distance blends.                             |
| **Prone Aim Backward Height Boost** | float | `0.3`   | Extra height when aiming backward to clear the head.       |
| **Prone Aim Offset Blend Speed**    | float | `3`     | How fast the offset blends when rotating.                  |
| **Lock Camera Input**               | bool  | `false` | Freezes camera look input.                                 |
| **Invert Y**                        | bool  | `false` | Inverts vertical look.                                     |

***

The base package ships a self-contained third-person camera, `rCameraController`, that follows the character, orbits on mouse/right-stick, collides with geometry, and re-frames itself for each stance and for aiming.

### States

The camera is a small state machine — `Normal`, `Crouching`, `Prone`, plus aim and sprint modifiers — each with its own distance, height, and FOV settings (`normalState`, `crouchState`, `proneState`, `aimState`, `proneAimState`, `sprintState`). Transitions blend at `stateTransitionSpeed`, with separate speeds for distance and FOV so a sprint pull-back feels different from an aim snap-in.

### The controller drives it, not the other way around

Locomotion fires events; the controller translates them into camera calls:

```csharp
cameraController.SetNormal();
cameraController.SetCrouching();
cameraController.SetProne();
cameraController.SetAiming(true);
cameraController.SetSprinting(true);
```

All of these are guarded by `IsLocalPlayer`, so only the player's camera reacts — an AI driving the same body never touches a camera.

### Other knobs

`inputSensitivity` / `mobileInputSensitivity`, `invertY`, and clamp angles (`clampAngleUp`, `clampAngleDown`) tune feel. Aiming shifts to an over-the-shoulder offset (`aimPositionOffset`) at `aimCameraDistance`. A companion collision script reads `cameraDistance` and pulls the camera in when a wall is in the way.

### Want Cinemachine instead?

The camera is fully swappable. See Cinemachine Integration to drive framing through a Cinemachine rig while keeping the same stance/aim event flow.


---

# 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/camera-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.
