19 lines
1.1 KiB
Luau
19 lines
1.1 KiB
Luau
-- Candy Cane Arch: 12.5 studs tall so players walk through it; the mesh hulls would close the opening, so the
|
|
-- meshes don't collide and two invisible pillar blockers do.
|
|
local m = game.ReplicatedStorage.OrnamentMachine.Decor.CandyCaneArch
|
|
for _, c in m:GetChildren() do if c.Name == "PillarCollider" then c:Destroy() end end
|
|
local _, size0 = m:GetBoundingBox()
|
|
m:ScaleTo(m:GetScale() * 12.5 / size0.Y)
|
|
m:PivotTo(CFrame.new(0, 0.1, 0))
|
|
for _, p in m:GetDescendants() do if p:IsA("MeshPart") then p.CanCollide = false end end
|
|
local cf, size = m:GetBoundingBox()
|
|
for _, s in { -1, 1 } do
|
|
local c = Instance.new("Part"); c.Name = "PillarCollider"; c.Shape = Enum.PartType.Cylinder
|
|
c.Size = Vector3.new(size.Y * 0.62, 1.4, 1.4) -- cylinder axis = X -> turned upright
|
|
c.CFrame = CFrame.new(s * (size.X / 2 - 0.75), size.Y * 0.31, cf.Position.Z) * CFrame.Angles(0, 0, math.rad(90))
|
|
c.Transparency, c.Anchored, c.CanCollide, c.CastShadow = 1, true, true, false
|
|
c.Parent = m
|
|
end
|
|
local base = m.PrimaryPart; base.Size = Vector3.new(size.X, 0.2, size.Z)
|
|
return string.format("arch %.1f x %.1f x %.1f, opening ~%.1f", size.X, size.Y, size.Z, size.X - 3)
|