I’ve made a wall-building script like this:
And now I am trying to build different roofs with different areas, but I can only figure out the solution when the area is a square.
A square has four vertices. I calculate the smallest one and the largest one, then we can get the cframe of a square part.
I describe an area with a line class:
local LineClass = {
id = nil,
startPos = Vector2.new(0,0),
endPos = Vector2.new(0,0),
__eq = function(line1, line2)
if line1.startPos == line2.startPos and line1.endPos == line2.endPos then
return true
else
return false
end
end
}
local AreaClass = {
linesTable = {}, -- LineClass
pointsTable = {}, -- Vector2
hasRoof = false
}
I was trying to build two roofs, but could not make out when the area was not square.
Anyone got any ideas?