@UberGoober You get the point. Indeed, the complexity of a custom block can affect the stability of your application. The more complex a block is, the more resource intensive it is and the more likely it is to crash. I just collected some voxel system documentation and experimented with it, and it’s a great visualization tool. But perhaps because of the steep learning curve and the lack of documentation, there aren’t many user-initiated projects. You can see the experimental code I posted earlier on voxel systems. In fact, the rigidbody is the default configuration for each voxel block (except for glass and water, which are two types of blocks that can pass right through, perhaps without attaching to the rigid body) , since each voxel block must be able to be mined, can be an obstacle.
Below is an example, you can change the radius to see the max value
-- ExEzBlocks
-- ?????????
-- viewer.mode = FULLSCREEN_NO_BUTTONS
viewer.mode = FULLSCREEN
function setup()
scene = craft.scene()
-- ?? OrbitViewer????? voxels ???????????????????????????
player = scene.camera:add(OrbitViewer, vec3( 40, 20, -10), 80, 1, 900)
-- ?? voxel ????:???????
scene.voxels:resize(vec3(5,1,5))
scene.voxels.coordinates = vec3(0,0,0)
-- ????? block type
scene.voxels.blocks:addAssetPack("Blocks")
grass = scene.voxels.blocks:new("myGrass")
print(type(grass.id))
grass.setTexture(ALL, "Blocks:Dirt")
grass.setColor(ALL, color(239, 222, 5))
blinky()
-- ?? craft.voxels ??????? block type:SOLID
scene.voxels:fill("myGrass")
-- ?????? SOLID ????????????????
scene.voxels:box(0,0,0, 16*8,1,16*8)
-- try set radius to 12,13,14,15,16,17
radius = 17
scene.voxels:fill("Blinky")
scene.voxels:sphere(40,50,90,radius)
scene.voxels:fill("Blinky")
scene.voxels:line(10,20,0,10,50,30)
scene.voxels:block(vec3(30,20,35))
-- ???? block type ??
scene.voxels:fill("myGrass")
scene.voxels:block(vec3(40,20,35))
-- ????block
grass.update = function(entity, dt)
print("uuuuu")
entity.y = math.sin(ElapsedTime)
end
grass.destroyed = function(entity)
sound(SOUND_POWERUP)
end
craft.scene.main = scene
end
function update(dt)
scene:update(dt)
end
function draw()
update(DeltaTime)
scene:draw()
end
-- ???????? block type ??
-- ??????block
function blinky()
local Blinky = scene.voxels.blocks:new("Blinky")
Blinky.setTexture(ALL, "Blocks:Stone")
-- Blinky.setColor(ALL, color(239, 222, 5))
Blinky.geometry = TRANSLUCENT
Blinky.renderPass = TRANSLUCENT
Blinky.tinted = true
Blinky.dynamic = true
Blinky.scriped = true
-- the internal script
function Blinky:created()
-- Schedule an update in one second
self:schedule(60)
-- self:blockUpdate(60)
end
function Blinky:blockUpdate(ticks)
-- Create a random color
-- local x,y,z = self:xyz()
-- print("----")
local randomColor = color(math.random(128,255), math.random(128,255), math.random(128,255))
-- Blinky.setColor(ALL, randomColor)
-- Blinky.setColor(DOWN, randomColor)
-- set block color and then schedule another update in one second
-- self:set(vec3(x,y,z),COLOR, randomColor)
self:set(COLOR, randomColor)
self:schedule(10)
end
end