# World.getDominantMaterialInCapsule

Finds the dominant voxel material inside a capsule volume.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
world:getDominantMaterialInCapsule( position, radius, height )
```

[Open the full Game reference](../Game-Script-Environment/Userdata/World.md#getdominantmaterialincapsule)

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `world` | [World](../Game-Script-Environment/Userdata/World.md) | The world to look in. |
| `position` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The center position of the capsule. |
| `radius` | number | The radius of the capsule. |
| `height` | number | The height of the cylindrical part of the capsule (Z-axis aligned, excluding hemispherical caps). |

**Returns:**

| Type | Description |
| --- | --- |
| integer | The dominant material index value. (returns nil if no voxel was found) |
| integer | The highest single-voxel density of the dominant material. |
| [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The weighted average world position of the dominant material (biased toward dense, nearby voxels) |
