# Protocol: ground

The `ground` commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to [all commands](../protocol-commands.md).

## ground.at

`ground.at {x: number, z: number} -> {step: integer, entity: text, height: number, normal: [number], layers: [number]}` · read, read-only

Reads the ground under a point: of the things with a Ground (a height field, `.ground.toml`) the lowest whose field is under x and z, the height of its surface there and its normal, as the cooked heights have it: each cell two triangles, split from its corner nearest -x and -z, the way the physics splits it. A Ground is placed by its thing's Transform (x, y, z; its turn and scale are not read). Nothing is changed.

| Parameters | Type | Meaning |
| --- | --- | --- |
| `x` | number | Metres along x, in the world. |
| `z` | number | Metres along z, in the world. |

| Result | Type | Meaning |
| --- | --- | --- |
| `step` | integer | How many fixed steps have run. |
| `entity` | text | The thing whose ground is there, by its name (or id); null where no ground is. |
| `height` | number | The surface's y there, in the world; null where no ground is. |
| `normal` | [number] | The surface's normal there, [x, y, z], one long and up; null where no ground is. |
| `layers` | [number] | Each of the ground's picture layers' weight there, in their order, adding up to 1 (the rule its pictures are drawn by); empty for a ground with no layers, drawn in its colour. |
