Voxel Destructible
Models or parts tagged with voxel_destructible can be blown apart by explosions. When an explosion hits, the object is converted into a voxel grid and the cells within the blast radius are removed, leaving a hole. The removed pieces fly off as debris.
Setup
- Create a
ModelorBasePart - Add the
voxel_destructibletag
The object is not voxelized until it actually gets hit by an explosion, so there's no performance cost for placing many of them.
Attributes
All attributes are optional.
GridSize(number) — Size of each voxel cell in studs. Smaller values = more detailed destruction but more parts. If not set, usesvoxel_default_grid_size
Shared Variables
These can be changed at runtime via the insitux console or mods.
voxel_destruction_radius(number, 10) — Radius in studs of the hole created by explosionsvoxel_bullet_destruction_radius(number, 0) — Radius of destruction from bullet hits. Set to 0 by default (bullets don't destroy voxels). Increase to allow gunfire to chip away at objectsvoxel_default_grid_size(number, 0.5) — Default voxel cell size in studs when the part doesn't have aGridSizeattribute. Going lower than 0.5 causes heavy lagvoxel_default_voronoi_density(number, 0.01) — Controls how the flying debris chunks are split up. Higher values = more, smaller debris piecesvoxel_throw_force(number, 40) — How hard debris is launched away from the explosion. Higher values = debris flies further