Doesn’t look like it supports part rotation to me, and is 2D. What about my adjustment below? Sorry if it doesn’t work, I can’t run ROBLOX on my work computer so I gotta hope I didn’t message up
local gMaxX = Math.max(Point1.X, Point2.X) -- X
local gMinX = Math.min(Point1.X, Point2.X)
local gMaxY = Math.max(Point1.Y, Point2.Y) -- Y
local gMinY = Math.min(Point1.Y, Point2.Y)
local gMaxZ = Math.max(Point1.Z, Point2.Z) -- Z
local gMinZ = Math.min(Point1.Z, Point2.Z)
-- ... for blah in blah do
-- Find all corners of the part
local c1 = v.CFrame * CFrame.new(v.Size.X / 2, v.Size.Y / 2, v.Size.Z / 2)
local c2 = v.CFrame * CFrame.new(-v.Size.X / 2, v.Size.Y / 2, v.Size.Z / 2)
local c3 = v.CFrame * CFrame.new(-v.Size.X / 2, -v.Size.Y / 2, v.Size.Z / 2)
local c4 = v.CFrame * CFrame.new(-v.Size.X / 2, -v.Size.Y / 2, -v.Size.Z / 2)
local c5 = v.CFrame * CFrame.new(v.Size.X / 2, -v.Size.Y / 2, -v.Size.Z / 2)
local c6 = v.CFrame * CFrame.new(v.Size.X / 2, v.Size.Y / 2, -v.Size.Z / 2)
local c7 = v.CFrame * CFrame.new(v.Size.X / 2, -v.Size.Y / 2, v.Size.Z / 2)
local c8 = v.CFrame * CFrame.new(-v.Size.X / 2, v.Size.Y / 2, -v.Size.Z / 2)
-- Find bounds of the part from the corners
local maxX = Math.max(c1.X, c2.X, c3.X, c4.X, c5.X, c6.X, c7.X, c8.X)
local minX = Math.min(c1.X, c2.X, c3.X, c4.X, c5.X, c6.X, c7.X, c8.X)
local maxY = Math.max(c1.Y, c2.Y, c3.Y, c4.Y, c5.Y, c6.Y, c7.Y, c8.Y)
local minY = Math.min(c1.Y, c2.Y, c3.Y, c4.Y, c5.Y, c6.Y, c7.Y, c8.Y)
local maxZ = Math.max(c1.Z, c2.Z, c3.Z, c4.Z, c5.Z, c6.Z, c7.Z, c8.Z)
local minZ = Math.min(c1.Z, c2.Z, c3.Z, c4.Z, c5.Z, c6.Z, c7.Z, c8.Z)
-- Note >= for inclusive. Could change to > for within. Same with <=.
if minX >= gMaxX and maxX <= gMaxX and minY >= gMaxY and maxY <= gMaxY and minZ >= gMaxZ and maxZ <= gMaxZ then
print("yes")
Mine is going to be pretty slow as you add more parts because of all the CFrame operations. I’d grab a pen and paper and math it out if you want it to be quicker.