Whenever I try to write:
scene.voxels.coordinates = insert position here
It never updates to that position for some reason. I’ll post the code from my project if necessary, but any help at all is greatly appreciated!
Whenever I try to write:
scene.voxels.coordinates = insert position here
It never updates to that position for some reason. I’ll post the code from my project if necessary, but any help at all is greatly appreciated!
scene.voxels.coordinates isn’t a position for individual voxels, but the center position of where all the voxels will be drawn. Think of the center of a circle with the voxels being drawn around that point. Voxels can’t be negative so they only get drawn in the upper left quadrant of a circle.
@dave1707 - hmmmm, I don’t follow that unless you set the scene.voxels.coordinates to the bottom right corner of the screen. That sounds more like a camera focal point.
@Bri_G Try running the below code uncommenting one of the lines each time. You’ll see the voxels being drawn from the coordinates position.
viewer.mode=FULLSCREEN
function setup()
assert(OrbitViewer, "Please include Cameras as a dependency")
scene = craft.scene()
v=scene.camera:add(OrbitViewer, vec3(80,80,0), 500, 0, 2000)
v.rx,v.ry=40,0
scene.voxels.blocks:addAssetPack("Blocks")
water = scene.voxels.blocks:new("Water")
water.setTexture(ALL, "Blocks:Water")
scene.voxels:resize(vec3(15,1,15))
scene.voxels.coordinates = vec3(0,0,0)
--scene.voxels.coordinates = vec3(200,0,0)
--scene.voxels.coordinates = vec3(0,0,200)
--scene.voxels.coordinates = vec3(200,0,200)
for x=1,200 do
for z=1,200 do
scene.voxels:fill("Water")
scene.voxels:block(x,0,z)
end
end
end
function draw()
update(DeltaTime)
scene:draw()
end
function update(dt)
scene:update(dt)
end