fenomas / noa

Experimental voxel game engine.
MIT License
611 stars 87 forks source link

A function to set all blocks within a certain distance to a block type #127

Closed csf30816 closed 4 years ago

csf30816 commented 4 years ago

It would be nice and would let making tunnels be easier. Something that would change the type of all the blocks within a 3D distance of another block. Ex:

// remove all blocks that are closer than 3units away
data.setDistance(x, y, z, 3 /*distanceInBlocks*/, 0);

This could be used for lakes, caves, and craters. I know its something I could implement in my own code, but still, it'd be nice.

fenomas commented 4 years ago

Hi, yeah - I have various functions like this in my own projects. But I think every game's needs will be a bit different, so I think it's best to leave this to client apps!

With that said, the engine defers these kinds of updates until the next tick event, so performance-wise, it's safe to change 100 blocks all at once, it won't trigger terrain meshing 100 times or anything.