Mining pack overview

This is a voxel mining setup that uses real prefabs for blocks, not marching cubes. Each block swaps into fractured variants when you hit a sector. Exposed faces stay, hidden faces are culled. Mined sectors can spawn item drops tied to your item data. Drop it in a scene, press play, and it already mines

What you get

Chunk spawner that fills a grid with weighted block prefabs
Fracturable block that switches visual variants by hit sector
Optional flood fill spawning for cave or vein style areas
Simple occlusion so only visible faces exist
Drop spawner that tags pickups with item data
Tiny raycast miner and a basic fps controller to test

How it works

Blocks live on a clean grid inside a chunk. A fractured block knows multiple variants like full, chipped, empty. The raycast reads which sector was hit using a mask texture red channel or a UV grid and tells the block to switch to the right variant. When the block is emptied the chunk marks that cell gone and neighbors reveal new faces. On variant change the drop spawner can eject pickups that carry the same item data so your inventory can identify them without extra code

Quick setup

Make a ground mesh and put it on a layer used for occlusion and flood limits
Create a few item data assets for stone or ores and set icons, price, optional world and drop prefabs
Make a block prefab, add fractured block, author a few child variants and assign their codes
Add drop on fracture to the block if you want pickups
Add a chunk to an empty object, set size and block size, add your block types with weights and their item data
Place optional no mesh volumes to carve tunnels and rooms
Add the camera with mouse look, a body with character controller and player movement, and put the raycast component on the camera
Press play and click blocks

Scripts

ItemData holds names, ids, stack size, price, material, optional world and droplet prefabs, basic tool flags
DropTag sits on a drop and stores which ItemData it is
FracturedBlock holds the visual variants, figures out sector hits, swaps the active child, notifies drop spawners, and tells the chunk when the block is gone
DropOnFracture spawns pickups when the variant changes, adds impulse, tags them with ItemData
VoxelFractureChunk spawns the grid, assigns block types by weight, culls hidden faces, handles neighbor refresh, optional flood fill growth, optional distance based collider enable
VoxelNoMeshVolume is a scene volume that forbids spawning inside it to carve paths and rooms
rayCast is a simple left click miner that sends the RaycastHit to the block so sector lookup works
MouseLook and PlayerMovement are barebones fps controls for testing

Notes

Use the same block size across all chunks
Put chunks on a world grid that matches the block size so edges line up
Distance based collider enable is there for performance on larger scenes
Sector ids can come from a mask texture or from a UV grid if you prefer zero texture setup

License

Standard use. You can use this in your own product and sell your product. You cannot resell the asset itself or claim the mechanic or its art as your own. Editing inside your project is fine. Attribution to GDF Studio is appreciated but not required


If you encounter problems or have question Discord contact GDF Studio:
https://discord.gg/TEMJvF7F6x

Published 18 hours ago
StatusIn development
CategoryAssets
AuthorFokus
Made withUnity
TagsAsset Pack, Generator, Loot, mine, mining, Physics, Unity, Voxel

Purchase

Buy Now$60.00 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $60 USD. You will get access to the following files:

GDF Studio Mining Mechanic.rar 1.3 MB

Download demo

Download
Mining Mechanic Demo.rar 21 MB