# World.voxelDensitySubtraction

Modify destructible terrain around a point or line with a radius.

**Kind:** Function

**Environments:** Game

## Game

### Overload 1

``` { .lua .api-signature }
world:voxelDensitySubtraction(
    position,
    direction,
    radius,
    targetDensity,
    filter?,
    enableDestructionEffect?,
    callback?,
    params?
)
```

[Open the full Game reference](../Game-Script-Environment/Userdata/World.md#voxeldensitysubtraction-vec3-vec3-number-integer-integer-optional-boolean-optional-string-optional-any-optional)

**Availability:** Server only

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `world` | [World](../Game-Script-Environment/Userdata/World.md) | The world. |
| `position` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The world position a of the modification. |
| `direction` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The world direction of the modification. Non normalized direction that defines the center line of modification. |
| `radius` | number | The maximum distance from positions in the line defined by position and direction that can be modified. |
| `targetDensity` | integer | The target density to remove. |
| `filter` *(optional)* | integer | The materials the shape can modify. (See [sm.world.voxelFilter](../Game-Script-Environment/Static-Functions/sm.world.md#voxelfilter)). (Defaults to sm.world.voxelFilter.all) |
| `enableDestructionEffect` *(optional)* | boolean | Whether to enable destruction effect. (Defaults to true) |
| `callback` *(optional)* | string | Lua function to call when cell is loaded. Callback parameters are a table of destruction data \{ remDensities = \{integer, ..\}, avgPositions = \{[Vec3](../Game-Script-Environment/Userdata/Vec3.md), ..\} \} and (optional) pass-through params passed to this function. |
| `params` *(optional)* | any | Parameter passed to the callback. (Optional) |

### Overload 2

``` { .lua .api-signature }
world:voxelDensitySubtraction(
    position,
    direction,
    radius,
    targetDensities,
    filter?,
    enableDestructionEffect?,
    callback?,
    params?
)
```

[Open the full Game reference](../Game-Script-Environment/Userdata/World.md#voxeldensitysubtraction-vec3-vec3-number-table-integer-optional-boolean-optional-string-optional-any-optional)

**Availability:** Server only

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `world` | [World](../Game-Script-Environment/Userdata/World.md) | The world. |
| `position` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The world position a of the modification. |
| `direction` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The world direction of the modification. Non normalized direction that defines the center line of modification. |
| `radius` | number | The maximum distance from positions in the line defined by position and direction that can be modified. |
| `targetDensities` | table | A table of target densities to remove per material type \{[1] = integer, .., [8] = integer\}. |
| `filter` *(optional)* | integer | The materials the shape can modify. (See [sm.world.voxelFilter](../Game-Script-Environment/Static-Functions/sm.world.md#voxelfilter)). (Defaults to sm.world.voxelFilter.all) |
| `enableDestructionEffect` *(optional)* | boolean | Whether to enable destruction effect. (Defaults to true) |
| `callback` *(optional)* | string | Lua function to call when cell is loaded. Callback parameters are a table of destruction data \{ remDensities = \{integer, ..\}, avgPositions = \{[Vec3](../Game-Script-Environment/Userdata/Vec3.md), ..\} \} and (optional) pass-through params passed to this function. |
| `params` *(optional)* | any | Parameter passed to the callback. (Optional) |
