Well, basically I’m working on a wall placement system but I don’t want to use cylinders to fix these gaps, I want to use a normal part that works as a fill like the Stravant’s gap filler plugin does work.
This is an example of what I want to achieve in live-game:
The only reference that I have is the blue dot which is the intersection between these walls
1 Like
Apicphis
(Apicphis)
March 23, 2022, 9:28pm
#2
To do this, you can create a new part that is positioned where your blue dot is marked.
If you rotate it on a 45 degree angle and use some Pythagoras to find the length, it should work the same as GapFill.
2 Likes
You totally right! I will try with your solution if the the current method that is by lerping the edges does not work.
Well, it worked but I don’t have a way to determine if the wall that needs to fill the gap in the front or back position.
Bumping topic, I still need a solution
I got this as I don’t have any way to determine if the position is back or front
Well, finally solved it with, this is the source code:
local Polls = workspace.Polls
local WallPart = Instance.new("Part")
WallPart.Anchored = true
--
while task.wait() do
workspace.Walls:ClearAllChildren()
for i = 1, (#Polls:GetChildren() - 1) do
local CurrentPoll: BasePart = Polls[i]
local NextPoll: BasePart = Polls[i+1]
local CurrentWall = WallPart:Clone()
CurrentWall.Parent = workspace.Walls
--CurrentWall.Transparency = 0.5
local Distance = (CurrentPoll.Position - NextPoll.Position).Magnitude
local NewCFrame = CFrame.lookAt(CurrentPoll.Position, NextPoll.Position) * CFrame.new(0, 0, -(Distance / 2))
CurrentWall.Size = Vector3.new(0.5, 5, Distance)
CurrentWall.CFrame = NewCFrame * CFrame.new(0, 2.5, 0)
if NextPoll and i < (#Polls:GetChildren() - 1) then
do
local NextDistance = (NextPoll.Position - Polls[i+2].Position).Magnitude
local NextCFrame = CFrame.lookAt(
NextPoll.Position, Polls[i+2].Position
) * CFrame.new(0, 0, -(NextDistance / 2))
local CurrentEdge = CurrentWall.CFrame * CFrame.new(0.25, 0, -(Distance / 2))
local NextEdge = NextCFrame * CFrame.new(0.25, 2.5, (NextDistance / 2))
--
local Intersection = CurrentEdge:Lerp(NextEdge, 0.5)
local Gap = WallPart:Clone()
Gap.Size = Vector3.new(0.25, 5, (CurrentEdge.Position - NextEdge.Position).Magnitude)
Gap.CFrame = Intersection * CFrame.new(-0.125, 0, 0)
Gap.Parent = workspace.Walls
end
do
local NextDistance = (NextPoll.Position - Polls[i+2].Position).Magnitude
local NextCFrame = CFrame.lookAt(
NextPoll.Position, Polls[i+2].Position
) * CFrame.new(0, 0, -(NextDistance / 2))
local CurrentEdge = CurrentWall.CFrame * CFrame.new(-0.25, 0, -(Distance / 2))
local NextEdge = NextCFrame * CFrame.new(-0.25, 2.5, (NextDistance / 2))
--
local Intersection = CurrentEdge:Lerp(NextEdge, 0.5)
local Gap = WallPart:Clone()
Gap.Size = Vector3.new(0.25, 5, (CurrentEdge.Position - NextEdge.Position).Magnitude)
Gap.CFrame = Intersection * CFrame.new(0.125, 0, 0)
Gap.Parent = workspace.Walls
end
end
end
--break;
end
If anybody reading this post needs help with understanding the code, I will be open to help!
5 Likes