How outline of multiple parts

How can I get the outline of multiple parts? They can be rotated only on the Y axis and have any size.


I so far have code for finding the outline of a single part:

Code for getting outline of single part
local OutsideDirections = {
	{Vector3.new(1,0,0), "X"},
	{Vector3.new(-1,0,0), "X"},
	{Vector3.new(0,0,1), "Z"},
	{Vector3.new(0,0,-1), "Z"}
}

local function GetPartBorders(Part)
	for _, Data in pairs(OutsideDirections) do

		local Axis = Data[2]
		local OppositeAxis = (Axis == "X") and "Z" or "X"
		local Direction = Data[1]
		local PartSize = Part.Size
		local HalfPartSize = PartSize/2

		local PartLength = PartSize[Axis]
		local PartWidth = PartSize[OppositeAxis]

		local BorderWidth = 1

		local Cfr = (Part.CFrame * 
			CFrame.new(
				Data[1] * HalfPartSize[Axis]
			)
		)
		
		return Cfr, PartLength, PartWidth
	end
end

Which would give something like this:

image


But I need to find an outline with multiple parts with different rotations, like this:


An get the outline:

How can I do this? I’m just looking to be pointed in the right direction, if there are any pre-existing topics let me know

Try Grouping the Models and using a Highlight

I’m not using this visually, I’m looking for the CFrames and width of the outlines