> For the complete documentation index, see [llms.txt](https://fehdead.gitbook.io/npc-kit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/lockbehindcamera.md).

# npc.lockbehindcamera

```lua
npc.lockbehindcamera(posX, posY, posZ)
```

|                         |                                |
| ----------------------- | ------------------------------ |
| id                      | `0x01CA`                       |
| arguments               | 3: Int, Int, Int               |
| in NPC Kit              | yes                            |
| measured from a kit NPC | returns                        |
| vanilla scripts         | 15 calls in 13 of 1114 scripts |

## What it does

Points the follow camera (the one behind the player) at a fixed spot of the map: the camera keeps following the player but looks at that point, until [unlockbehindcamera](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/unlockbehindcamera.md).

## Arguments

### `posX` (Int)

The point's x, in map coordinates. The three are taken as whole numbers: `91.7` becomes `91`.

### `posY` (Int)

The point's height. Vanilla passes the player's height plus 2 to 6.

### `posZ` (Int)

The point's z.

## Timing

Returns at once.

## In NPC Kit

Live in the editor's Follow camera group, with the NPC's position as the default point, so the camera turns to the NPC.

## Used with

* [unlockbehindcamera](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/unlockbehindcamera.md): releases it; vanilla's 15 calls are all paired.

## Example

While the player stands near the NPC, the camera keeps it in view.

```lua
approach = function()
    npc.lockbehindcamera(91, 3, 130);   -- whole numbers only
    npc.waitdistance(91.3, 130.0, 2.0);
    npc.unlockbehindcamera();
end,
```

## Pitfalls

* The fractions are dropped: a point that matters to a tenth will be off by up to one unit.
* It is the player's camera: unlock it before the scene ends.
