Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function API:PositionAround(wall: BasePart, window: BasePart)
- local aPos = wall.Position
- local aSize = wall.Size
- local bPos = window.Position
- local bSize = window.Size
- local pos1 = wall.CFrame * CFrame.new(0, aSize.Y / 2, aSize.Z / 2)
- local pos2 = wall.CFrame * CFrame.new(0, aSize.Y / 2, -(aSize.Z / 2))
- local pos3 = wall.CFrame * CFrame.new(0, -(aSize.Y / 2), aSize.Z / 2)
- local pos4 = wall.CFrame * CFrame.new(0, -(aSize.Y / 2), -(aSize.Z / 2))
- local pos5 = window.CFrame * CFrame.new(0, bSize.Y / 2, bSize.Z / 2)
- local pos6 = window.CFrame * CFrame.new(0, bSize.Y / 2, -(bSize.Z / 2))
- local pos7 = window.CFrame * CFrame.new(0, -(bSize.Y / 2), bSize.Z / 2)
- local pos8 = window.CFrame * CFrame.new(0, -(bSize.Y / 2), -(bSize.Z / 2))
- CreatePartAt(pos1, Color3.new(1, 0, 0))
- CreatePartAt(pos2, Color3.new(1, 1, 0))
- CreatePartAt(pos3)
- CreatePartAt(pos4)
- CreatePartAt(pos5, Color3.new(0, 1, 0))
- CreatePartAt(pos6, Color3.new(0, 0, 1))
- CreatePartAt(pos7)
- CreatePartAt(pos8)
- local sectionSize1 = math.abs(pos1.Position.Z - pos5.Position.Z)
- local sectionSize3 = math.abs(pos6.Position.Z - pos2.Position.Z)
- print(sectionSize1, sectionSize3)
- local sectionSize2 = math.abs(pos1.Position.Y - pos5.Position.Y)
- local sectionSize4 = math.abs(pos3.Position.Y - pos7.Position.Y)
- PrefabSection1.Size = Vector3.new(aSize.X, aSize.Y, sectionSize1)
- PrefabSection2.Size = Vector3.new(aSize.X, sectionSize2, bSize.Z)
- PrefabSection3.Size = Vector3.new(aSize.X, aSize.Y, sectionSize3)
- PrefabSection4.Size = Vector3.new(aSize.X, sectionSize4, bSize.Z)
- PrefabSection1.CFrame = pos1 * CFrame.new(0, -(aSize.Y / 2), -(sectionSize1 / 2)) --CFrame.new(Vector3.new(aPos.X, aPos.Y, pos1.Z - sectionSize1 / 2)) * wall.CFrame.Rotation
- PrefabSection2.CFrame = pos5 * CFrame.new(0, (sectionSize2 / 2), -(bSize.Z / 2))
- PrefabSection3.CFrame = pos2 * CFrame.new(0, -(aSize.Y / 2), (sectionSize3 / 2)) --CFrame.new(Vector3.new(aPos.X, aPos.Y, pos2.Z + sectionSize3 / 2)) * wall.CFrame.Rotation
- PrefabSection4.CFrame = pos7 * CFrame.new(0, -(sectionSize4 / 2), -(bSize.Z / 2)) --CFrame.new(Vector3.new(aPos.X, pos7.Y - sectionSize4 / 2, bPos.Z)) * wall.CFrame.Rotation
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement