Hello!
So I’m having this issue with my wall system where I am trying to fill a gap but it’s very frustrating because sometimes the part that’s created doesn’t orient right and causes it to look even uglier. Could someone help?
I’ve tried a few things:
1- find the intersection and create a part that’s 0.5 thick but the width is the same as the difference between the gap if that makes sense.
Code:
local fillerPartPoint1 = plot.CFrame:ToWorldSpace(CFrame.new(intersectingWallPoint1.Value) * CFrame.Angles(outerWall1.CFrame:ToOrientation())) * CFrame.new(-0.25,0,0)
local fillerPartPoint2 = plot.CFrame:ToWorldSpace(CFrame.new(intersectingWallPoint2.Value) * CFrame.Angles(outerWall2.CFrame:ToOrientation())) * CFrame.new(-0.25,0,0)
local plate = Instance.new('Part')
plate.Position = plot.CFrame:PointToWorldSpace(intersectingWallPoint1.Value)
plate.Orientation = (outerWall1.Orientation + outerWall2.Orientation) / 2
plate.Size = Vector3.new(0.5, 10, (fillerPartPoint1.Position - fillerPartPoint2.Position).Magnitude)
plate.Anchored = true
plate.Parent = outerWall1
Result (note the small misalignment):
2- find the position between the 2 gaps and make a part, then offset the CFrame by -0.25
Sizing works for the most part but sometimes the part is moved wrongly.
plate.Position = (fillerPartPoint1.Position + fillerPartPoint2.Position) / 2
plate.CFrame = CFrame.lookAt(plate.Position, fillerPartPoint1.Position)
plate.CFrame *= CFrame.new(-0.25,0,0)
plate.Size = Vector3.new(0.5, 10, (fillerPartPoint1.Position - fillerPartPoint2.Position).Magnitude)
plate.Anchored = true
plate.Parent = outerWall1
Result sometimes:
Result at other times (which is what I want to achieve)
Any ideas?
Feel free to test it out, use the Create Wall button:
ok.rbxl (36.5 KB)