Hello! I have been trying to recreate the old ROBLOX bevels that were used up to 2013.
My method of doing this was to create parts on the corners of the part and then subtracting them using Roblox’s CSG API.
I thought of adding an image of what i wish to achieve
However, when the part is not equally sized (Bounds such as 2, 2, 2) the bevels look really flat
The only solution i have found is another post in the forums. However, it uses EditableMeshes, which i find really complicated, on top of being really laggy.
This is the code i have currently
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GS = game:GetService("GeometryService")
local BevelCache = ReplicatedStorage:FindFirstChild("BevelCache")
if not BevelCache then return end
local part = script.Parent
local bevelTable = {}
local getCFrame = function(pos, part, direction)
return CFrame.lookAt(pos, part.Position)
end
local partNew = function(pos, bP, name)
local p = Instance.new("Part")
p.Size = Vector3.new(30, 30, .1) -- PLACEHOLDER
p.CFrame = getCFrame(pos, part)
p.Anchored = true
p.CanCollide = false
p.Parent = workspace
p.Name = name
table.insert(bevelTable, p)
end
local doBevels = function(bP: Part)
for x = -1, 1 do
for y = -1, 1 do
for z = -1, 1 do
-- Parenthesis for readability
local xy = (x == 0 and y == 0)
local yz = (y == 0 and z == 0)
local xz = (z == 0 and x == 0)
if xy or yz or xz then continue end
local xabs = math.abs(x)
local yabs = math.abs(y)
local zabs = math.abs(z)
print(xabs, yabs, zabs)
local pos = Vector3.new(bP.Size.X / 2 * (x), bP.Size.Y / 2 * (y ), bP.Size.Z / 2 * (z))
local offset = bP.CFrame:PointToWorldSpace(pos)
partNew(offset, bP, string.format("%s, %s, %s", x, y, z))
end
end
end
end
doBevels(part)
local s, f = pcall(function()
return GS:SubtractAsync(part, bevelTable)
end)
if s then
for i, v in pairs(bevelTable) do
v:Destroy()
end
part:Destroy()
f[1].Parent = workspace
end
if not s then
warn(f)
end
Thanks for the help in advance!