Read the ground height of a terrain
r3_terrain_heightHow high the ground of a heightfield terrain is at the world (x, z) positions you ask, exactly as physics and the drawn terrain have it, plus the terrain's lowest and highest point, centre, size and footprint. Use it to place something ON a terrain: an object stands on the ground at (x, z) when its lowest point is at the returned y (a vehicle: its wheels' bottom); the returned ground normal says how steep it is there. One call takes up to 100 points; with none it describes the terrain only.
terrain is the terrain's Mesh, GeometryHeightfield or ColliderHeightfield (entityRef or id); leave it out when the project has one terrain.
It reads the user's open R3 editor when it has the project (the terrain as on screen, a heightmap image included), else the saved project. A terrain shaped by a heightmap IMAGE needs the project open in R3 (r3_editor_open), because only a browser decodes the image. Read-only: nothing is changed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| points | No | World positions to sample, e.g. [{"x": 0, "z": 12.5}]. Up to 100. | |
| terrain | No | The terrain: its Mesh, GeometryHeightfield or ColliderHeightfield, by entityRef or id. Optional when the project has one terrain. | |
| projectId | Yes | The project, from r3_project_list or r3_project_create. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answer | Yes | This answer in words: what was done, what R3 measured, decided or refused, and what to do next. The same text as the result's text block. Read it: the fields beside it are the data, this is the guidance. | |
| editor | Yes | ||
| points | Yes | ||
| source | Yes | ||
| terrain | Yes | ||
| projectId | Yes | ||
| projectName | Yes |