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

# npc.cos

```lua
npc.cos(radians)
```

|                         |                                                                      |
| ----------------------- | -------------------------------------------------------------------- |
| id                      | `0x000A`                                                             |
| arguments               | 1: Float                                                             |
| result                  | Float: goes to the very next call, or to `npc.lua(npc.cos(...), fn)` |
| in NPC Kit              | yes                                                                  |
| measured from a kit NPC | returns                                                              |
| vanilla scripts         | 1279 calls in 189 of 1114 scripts                                    |

## What it does

Gives the cosine of an angle in radians. A result.

## Arguments

### `radians` (Float)

The angle.

## Result

The cosine, a float.

## Timing

Returns at once.

## In NPC Kit

Use Lua's `math.cos` when `npc.add` runs instead (see [sin](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/sin.md)).

## Used with

* [sin](https://fehdead.gitbook.io/npc-kit/vm-reference/calls/sin.md).

## Example

```lua
local home, h = { 29.36, -9.0, 68.65 }, 1.676
local ahead = { home[1] + math.sin(h) * 1.5, home[2], home[3] + math.cos(h) * 1.5 }

stepForward = function()
    npc.rmove(ahead[1], ahead[2], ahead[3]);
    npc.movesync();
end,
```
