User talk:Sduke524/SumoBots/Rings: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>NXTBoy |
>NXTBoy |
||
Line 22: | Line 22: | ||
local cleanPart = new("Part", function(p) | local cleanPart = new("Part", function(p) | ||
p.Anchored = true | p.Anchored = true | ||
p.TopSurface = "Smooth" | p.TopSurface = "Smooth" | ||
p.BottomSurface = "Smooth" | p.BottomSurface = "Smooth" | ||
p.formFactor = "Custom" | p.formFactor = "Custom" | ||
p.BrickColor = BrickColor.new("White") | p.BrickColor = BrickColor.new("White") | ||
end) | end) | ||
Line 33: | Line 33: | ||
with(cleanPart:clone(), function(center) | with(cleanPart:clone(), function(center) | ||
center.Name = "Center" | center.Name = "Center" | ||
center.Size | center.Size = Vector3.new(20, 0.31, 20) | ||
center.CFrame = position | center.CFrame = position | ||
new("CylinderMesh").Parent = center | new("CylinderMesh").Parent = center | ||
Line 43: | Line 43: | ||
with(cleanPart:clone(), function(inner) | with(cleanPart:clone(), function(inner) | ||
inner.Name = "Inner" | inner.Name = "Inner" | ||
inner.BrickColor = BrickColor.new("Really black") | inner.BrickColor = BrickColor.new("Really black") | ||
inner.Size = Vector3.new(10.1, 0.3, radius) | inner.Size = Vector3.new(10.1, 0.3, radius) | ||
inner.CFrame = cf * CFrame.new(0, 0, radius / 2) | inner.CFrame = cf * CFrame.new(0, 0, radius / 2) | ||
end).Parent = ring | end).Parent = ring | ||
with(cleanPart:clone(), function(outer) | with(cleanPart:clone(), function(outer) | ||
outer.Name = "Outer" | outer.Name = "Outer" | ||
outer.Size = Vector3.new(11, 0.3, 2) | outer.Size = Vector3.new(11, 0.3, 2) | ||
outer.CFrame = cf * CFrame.new(0, 0, radius + 1) | outer.CFrame = cf * CFrame.new(0, 0, radius + 1) | ||
end).Parent = ring | end).Parent = ring |
Latest revision as of 22:38, 18 March 2012
Suggested replacement
function with(obj, f) return f and f(obj) or obj end
function new(obj, f) return with(Instance.new(obj), f) end
function range(t)
local to, from = t[1] or t[0], t[1] and t[0] or 0
local span, i = to - from, 0
local steps = t.steps or span / t.step
return function()
if i < steps then
local n = from + span * i/steps
i = i + 1
return n
end
end
end
local itr = 25
local position = CFrame.new(0, 0.2, 0)
local radius = 40
local cleanPart = new("Part", function(p)
p.Anchored = true
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.formFactor = "Custom"
p.BrickColor = BrickColor.new("White")
end)
new("Model", function(ring)
ring.Name = "Ring"
with(cleanPart:clone(), function(center)
center.Name = "Center"
center.Size = Vector3.new(20, 0.31, 20)
center.CFrame = position
new("CylinderMesh").Parent = center
end).Parent = ring
for angle in range{2*math.pi, steps = itr} do
local cf = position * CFrame.Angles(0, angle, 0)
with(cleanPart:clone(), function(inner)
inner.Name = "Inner"
inner.BrickColor = BrickColor.new("Really black")
inner.Size = Vector3.new(10.1, 0.3, radius)
inner.CFrame = cf * CFrame.new(0, 0, radius / 2)
end).Parent = ring
with(cleanPart:clone(), function(outer)
outer.Name = "Outer"
outer.Size = Vector3.new(11, 0.3, 2)
outer.CFrame = cf * CFrame.new(0, 0, radius + 1)
end).Parent = ring
end
end).Parent = workspace