I am trying to make 2d physics like IP, but the positioning is… questionable.
It would be better if i just shown you images.
My code:
while wait() do
for i, obj in pairs(script.Parent:GetChildren()) do
if obj:IsA("Frame") then
obj:Destroy()
end
end
for i, obj in pairs(workspace.Objects:GetChildren()) do
if obj:IsA("BasePart") then
local Frame = game.ReplicatedStorage.Frame:Clone()
Frame.Parent = script.Parent
Frame.Position = UDim2.new() - UDim2.new(0, obj.Position.X * 10, 0, obj.Position.Y * 10) + UDim2.new(0.5, 0, 0.5, 0)
Frame.Size = UDim2.new(0, obj.Size.X * 10, 0, obj.Size.Y * 10)
Frame.Rotation = 0 - obj.Orientation.X
Frame.BackgroundColor = obj.BrickColor
end
end
end