World.voxelDensitySubtraction
Modify destructible terrain around a point or line with a radius.
Kind: Function
Environments: Game
Game
Overload 1
world:voxelDensitySubtraction(
position,
direction,
radius,
targetDensity,
filter,
enableDestructionEffect,
callback,
params
)
Availability: Server only
Parameters:
| Name | Type | Description |
|---|---|---|
world |
World | The world. |
position |
Vec3 | The world position a of the modification. |
direction |
Vec3 | 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). (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, ..} } and (optional) pass-through params passed to this function. |
params (optional) |
any | Parameter passed to the callback. (Optional) |
Overload 2
world:voxelDensitySubtraction(
position,
direction,
radius,
targetDensities,
filter,
enableDestructionEffect,
callback,
params
)
Availability: Server only
Parameters:
| Name | Type | Description |
|---|---|---|
world |
World | The world. |
position |
Vec3 | The world position a of the modification. |
direction |
Vec3 | 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). (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, ..} } and (optional) pass-through params passed to this function. |
params (optional) |
any | Parameter passed to the callback. (Optional) |