I’m having trouble with the FillBlock function.
Whenever I fill a region with terrain, there’s some inaccuracy.
In this video, the red part is a visualization of the size and CFrame of the water, filled with Terrain:FillBlock().
The water level is higher than it should be.
Sometimes it does this, sometimes it doesn’t. There doesn’t seem to be a pattern in this behavior.
Here’s my code:
for _, WaterLevel in pairs(Chunk.WaterLevels:GetChildren()) do
if (WaterLevel:IsA("BasePart")) and WaterLevel.Name == "WaterLevel" then
local WaterPos = Vector3.new(ChunkPos.X, WaterLevel.Position.Y, ChunkPos.Z) -- This position is accurate.
local WaterCF = CFrame.new(WaterPos)
local WaterSize = Vector3.new(ChunkSize.X, WaterLevel.Size.Y, ChunkSize.Z) -- Size is also accurate.
Terrain:FillBlock(WaterCF, WaterSize, Enum.Material.Water)
-- Test part to visualize the water cf and size.
local Tp = Instance.new("Part", workspace.Temp)
Tp.Anchored = true
Tp.CanCollide = false
Tp.Color = Color3.fromRGB(255,0,0)
Tp.CastShadow = false
Tp.CFrame = WaterCF
Tp.Size = WaterSize
end
end
Can I do something about this? Or is this just a thing that terrain does?