Better way of checking for available space for ramps and corner in voxel game?

  1. What do you want to achieve? Keep it simple and clear!

So i recently started experimenting with terrain generation and made some cool stuff with it.

But i then ran into a problem…

  1. What is the issue? Include screenshots / videos if possible!

I want my voxel game to be smooth. Like the old voxel terrain roblox had back in 2011.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Ive been looking at some posts but most of them are in C# and some doesnt even explain the method of smoothening voxel terrain really well.

So i am once again here asking the pros on how i could smooth out voxel terrain?

This is my current system btw(This was a test also). This is the result i get… It looks decent but not what i want lol(And its obviously not the best method)

local function R(P, Pa)
	local Params = RaycastParams.new()
	Params.FilterDescendantsInstances = {Pa}
	Params.FilterType = Enum.RaycastFilterType.Blacklist
	
	local Ray = game.Workspace:Raycast(P.Position, P.lookVector * 5, Params)
	
	if Ray then
		return true
	else
		return false
	end
end


for x = 1, 50 do
	for y = 1, 50 do
		for z = 1, 50 do
			local XN = math.noise(x / Scale, z / Scale) * AMp
			local YN = math.noise(y / Scale, x / Scale) * AMp
			local ZN = math.noise(y / Scale, z / Scale) * AMp

			local Max = XN + YN + ZN + y
			
		
			if Max <= 5 then
				local P = game.ServerStorage.Part:Clone()
				P.Position = Vector3.new(x * 4, y * 4, z * 4)
				P.Parent = game.Workspace.Terrain
				
				
				local Hit = R(P.CFrame, P) -- // Check if the ray hit something. If it did dont place a ramp. If it didnt then place a new rmap there
				
				if Hit == false then
					local W = game.ServerStorage.Wedge:Clone()
					W.CFrame = P.CFrame * CFrame.new(0, 0, -3.5) 
					W.Parent = game.Workspace.Terrain
				end
			end
		end
	end
	task.wait()
end
1 Like

Might be of some use.

1 Like