How do you get Region3 of a part

Im trying to remove terrain using a part. But whenever i use FillBlock it doesnt work properly. so im trying FillRegion but ive not worked with regions before :confused:

How do i get The Region of a part?

(it doesnt sound like i have but i cannot find this anywhere so i have to make a thread)

You probably looked at this already but it literally gives you what you need.

Terrain | Documentation - Roblox Creator Hub should work properly, just make sure that you use the correct 3 parameters:

part.CFrame,
part.Size,
Material

Material is Material | Documentation - Roblox Creator Hub

1 Like

In a script, you can use the following code to get a Region3 from a part:

local min = part.Position - (0.5 * part.Size)
local max = part.Position + (0.5 * part.Size)
local region = Region3.new(min, max)
4 Likes

game.Workspace.Terrain:FillBlock(GridList[i].CFrame , GridList[i].Size, Enum.Material.Air)

And theres like still bits of terrain inside the region

local min = GridList[i].Position - (0.5 * GridList[i].Size)
local max = GridList[i].Position + (0.5 * GridList[i].Size)
local region = Region3.new(min, max)
game.Workspace.Terrain:FillRegion(region, 10, Enum.Material.Air)
print(region)

It dont work, it might be cause i just dont understand resolution

Output:
19, 507, 97, 1, 0, 0, 0, 1, 0, 0, 0, 1; 10, 10, 10

Ye i just realised its because of the resolution.

Idk what it does. but in the terrain editing article above. there’s sample code of FillRegion. and they have this line:

region = region:ExpandToGrid(4)

and then i make the resolution 4 and it works better. im going to experiment with the numbers to see if one works perfectly

Thanks for all the help though guys,