From b0e0b83c0d36fa05a9cd289a5dcdaeefe3dfab74 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 28 Dec 2021 19:04:13 +0000 Subject: [PATCH] //sculpt: Add buffer to catch height variations in terrain --- worldeditadditions/lib/sculpt/apply.lua | 7 +++++-- worldeditadditions/lib/sculpt/brushes/circle_soft1.lua | 5 +---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/worldeditadditions/lib/sculpt/apply.lua b/worldeditadditions/lib/sculpt/apply.lua index d759ead..6887c0f 100644 --- a/worldeditadditions/lib/sculpt/apply.lua +++ b/worldeditadditions/lib/sculpt/apply.lua @@ -21,8 +21,11 @@ local function apply(pos1, brush_name, height, brush_size) ) local brush_size_radius = (brush_size_terrain / 2):floor() - local pos1_compute = pos1 - brush_size_radius - local pos2_compute = pos1 + brush_size_radius + Vector3.new(0, height, 0) + -- To try and make sure we catch height variations + local buffer = Vector3.new(0, math.min(height*2, 100), 0) + + local pos1_compute = pos1 - brush_size_radius - buffer + local pos2_compute = pos1 + brush_size_radius + Vector3.new(0, height, 0) + buffer pos1_compute, pos2_compute = Vector3.sort( pos1_compute, diff --git a/worldeditadditions/lib/sculpt/brushes/circle_soft1.lua b/worldeditadditions/lib/sculpt/brushes/circle_soft1.lua index 64db19b..704b077 100644 --- a/worldeditadditions/lib/sculpt/brushes/circle_soft1.lua +++ b/worldeditadditions/lib/sculpt/brushes/circle_soft1.lua @@ -10,9 +10,6 @@ return function(size) local border = 1 local kernel_size = 3 - local kernel_size_vec = {} - kernel_size_vec[0] = kernel_size - kernel_size_vec[1] = kernel_size -- Make the circle -- We don't use 0 to 1 here, because we have to blur it and the existing convolutional @@ -35,7 +32,7 @@ return function(size) local success2, msg = worldeditadditions.conv.convolve( brush, Vector3.new(size.x, 0, size.y), - kernel, kernel_size_vec + kernel, Vector3.new(kernel_size, 0, kernel_size) ) if not success2 then return success2, msg end