# CyberM.camera — client runtime

Runs inside the game process. Reads and presentation are local; anything that changes shared state has to go through the server.

6 functions.

## attach

```lua
CyberM.camera.attach()
```

`GAME` — Requires a live game instance.

Reattaches the camera to the body.

Attaches the CyberM camera to a game entity using the supplied local offset and rotation. Camera ownership is local to the resource generation; attaching replaces the resource's previous detached/attached camera state.

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6750) as `LuaCameraAttach`.

## detach

```lua
CyberM.camera.detach(x, y, z)
```

`GAME` — Requires a live game instance.

Detaches the camera from the body, with an offset in the body's own space.

Detaches the CyberM camera from its target while retaining a controllable camera view. It does not synchronize a camera to other players and is automatically restored during resource cleanup.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `x` | `number` | required | — |
| `y` | `number` | required | — |
| `z` | `number` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

Registered in `ResourceHost.cpp` (line 6749) as `LuaCameraDetach`.

## project

```lua
CyberM.camera.project(position)
```

`GAME` — Requires a live game instance.

Projects a world point into normalized WebUI viewport coordinates.

Uses REDengine's active camera projection. `(0,0)` is the top-left and `(1,1)` the bottom-right. `onScreen` is false for points behind the view or beyond the viewport.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `position` | `table { x, y, z }` | required | — |

Returns: `table { x, y, depth, distance, onScreen }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6753) as `LuaCameraProject`.

## setFov

```lua
CyberM.camera.setFov(degrees)
```

`GAME` — Requires a live game instance.

Sets the field of view, in degrees.

Changes the field of view of the camera currently controlled by CyberM. The value is validated by the native backend and applies only to this client's presentation.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `degrees` | `number` | required | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

```lua
CyberM.camera.setFov(90)
```

Registered in `ResourceHost.cpp` (line 6751) as `LuaCameraFieldOfView`.

## thirdPerson

```lua
CyberM.camera.thirdPerson(enabled, [distance], [height])
```

`GAME` — Requires a live game instance.

Switches the view to third person.

Turning it off restores the view the game had before the call, rather than some default.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `enabled` | `boolean` | required | — |
| `distance` | `number` | optional | — |
| `height` | `number` | optional | — |

Returns: `true on success, otherwise false`, `reason for the refusal`

```lua
CyberM.camera.thirdPerson(true, 2.5, 1.7)
```

Registered in `ResourceHost.cpp` (line 6748) as `LuaCameraThirdPerson`.

## view

```lua
CyberM.camera.view()
```

`GAME` — Requires a live game instance.

Where the view is: position, forward vector, field of view.

Returns the latest game-thread camera snapshot used by projection and presentation APIs. It is a same-client read and may return `nil, reason` while the game camera is unavailable.

Returns: `position (x, y, z)`, `forward (x, y, z)`, `field of view`

Registered in `ResourceHost.cpp` (line 6752) as `LuaCameraView`.

