While debuging my voxel library, it had became apparent to me that the voxels disabled all gui, including the CoreGui. From my extensive research, selection boxes were the problem. I have found that if you make a total of 22*30^2 (19800) SelectionBoxes with a LineThickness of 0.01, all Gui is completely invisible. Here are videos of the issue and their effects:
in studio:
in experience:
Currently, I have searched through a large portion of the devforum and I haven’t been able to find anyone with this similar issue nor a solution. The only two solutions I found is removing the selectionboxes entirely or increasing the SelectionBoxes’ LineThickness. Here is the code from my ModuleScript:
type VoxelLibrary = {
description:string,
voxelSize:number,
chunkSize:number,
bakingMode:number,
overlapParams:OverlapParams,
raycastParams:RaycastParams,
renderFolder:Folder,
baking:boolean,
bakingModes: {[string]: number},
currentVoxelMap:{{{number}}}?,
BakeVoxelMap:(VoxelLibrary, Vector3)->({{{number}}}?)
}
local lib:VoxelLibrary = {
description= "raycasting: uses more resources, more accurate. boundinbox: less resources, based on bounding box/selection box.",
voxelSize = 2,
chunkSize = 1,
currentVoxelMap = nil,
renderFolder=Instance.new("Folder", workspace),
overlapParams = OverlapParams.new(),
raycastParams = RaycastParams.new(),
baking = false,
bakingModes = {BoundInBox = 1, Raycasting = 2},
bakingMode = 1,
directions = {
Vector3.new(1, 0, 0), Vector3.new(-1, 0, 0),
Vector3.new(1, 1, 0), Vector3.new(-1, -1, 0),
Vector3.new(1, -1, 0), Vector3.new(-1, 1, 0),
Vector3.new(1, -1, 1), Vector3.new(-1, 1, -1),
Vector3.new(1, -1, -1), Vector3.new(-1, 1, 1),
Vector3.new(0, 1, 0), Vector3.new(0, -1, 0),
Vector3.new(0, 1, 1), Vector3.new(0, -1, -1),
Vector3.new(0, -1, -1), Vector3.new(1, -1, 1),
Vector3.new(-1, -1, -1),
Vector3.new(0, 0, 1), Vector3.new(0, 0, -1),
Vector3.new(1, 0, 1), Vector3.new(-1, 0, 1),
},
BakeVoxelMap = function(self, bakingSize:Vector3):{{{number}}}?
--if self.baking == true then return warn("already baking.") end
local voxelMap:{{{number}}} = {}
local voxelBakingSize:Vector3 = (bakingSize / self.voxelSize):Abs() - Vector3.one
local voxelChunkSize = bakingSize/self.voxelSize/self.chunkSize
print(voxelChunkSize)
local renderVoxelSize:Vector3 = Vector3.one * self.voxelSize
--self.baking = true
for chunk=1, self.chunkSize, 1 do
local offset = Vector3.new(voxelChunkSize.X*(chunk-1), 0, voxelChunkSize.Z * (chunk-1)%(self.chunkSize*.5))
--local chunkPart = Instance.new("Part") do
-- chunkPart.Size = voxelChunkSize
-- chunkPart.Position = offset
-- chunkPart.Parent = self.renderFolder
-- chunkPart.Anchored = true
-- chunkPart.CanCollide = false
-- chunkPart.Transparency = .8
--end
--print(offset)
for x=0, voxelChunkSize.X, 1 do
local row = {}
for y=0, voxelBakingSize.Y, 1 do
local column = {}
for z=0, voxelChunkSize.Z, 1 do
local position = (Vector3.new(x,y,z)-(voxelBakingSize*Vector3.new(1, 0, 1)*.5))*self.voxelSize + offset
local depth = 0
--local thing
if self.bakingMode == 1 then
if #workspace:GetPartBoundsInBox(CFrame.new(position), renderVoxelSize, self.overlapParams) > 0 then depth = 2 end
elseif self.bakingMode == 2 then
for _, direction in self.directions do
local cast = workspace:Raycast(position-direction*(self.voxelSize*.51), direction*(self.voxelSize*1.02), self.raycastParams)
if cast then depth = 2 break end
end
else
depth = 2
end
if depth>0 then
local p = Instance.new("Part") do
p.Position = position
p.BrickColor = BrickColor.random()
p.Anchored = true
p.Parent = self.renderFolder
p.Size = renderVoxelSize
p.CanCollide = false
end
local selectionBox = Instance.new("SelectionBox") do
selectionBox.Color3 = Color3.new(0,0,0)
selectionBox.LineThickness = 0.01
selectionBox.Adornee = p
selectionBox.Parent = p
end
end
table.insert(column, depth)
end
table.insert(row, column)
end
task.wait()
table.insert(voxelMap, row)
end
task.wait()
end
--self.baking = false
return voxelMap
end
}
--lib:BakeVoxelMap(Vector3.new(100, 100, 100))
return lib
If you have any solutions other then removing or changing the LineThickness of the SelectionBoxes, please share them!