# Open77.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
Open77.camera.attach()
```

`GAME` — Requires a live game instance.

Reattaches the camera to the body.

Attaches the Open77 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 6887) as `LuaCameraAttach`.

## detach

```lua
Open77.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 Open77 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 6886) as `LuaCameraDetach`.

## project

```lua
Open77.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 6890) as `LuaCameraProject`.

## setFov

```lua
Open77.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 Open77. 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
Open77.camera.setFov(90)
```

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

## thirdPerson

```lua
Open77.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
Open77.camera.thirdPerson(true, 2.5, 1.7)
```

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

## view

```lua
Open77.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 6889) as `LuaCameraView`.

