I’m messing around with displaying surfaceguis like screenguis, but I ran into an issue when trying to show more than 1 part in the player’s camera.
Right now what I have can put 1 part in the camera, and size it to the point where a surfacegui can render perfectly on the part:
Now, the issue I’m running into starts when trying to use multiple parts and render them relative to the player’s camera as if it was a screengui, for example:
I have not been able to find an effective way to scale the child part(s) with the main background properly. This is what I’m aiming for:
Any guidance would be appreciated
Code so far:
local offset = 5
local part = workspace.UITemplates.Model.Part
game:GetService("RunService").RenderStepped:Connect(function()
local ViewSizeX = ScreenSpace.ViewSizeX()
local ViewSizeY = ScreenSpace.ViewSizeY()
part.Position = workspace.CurrentCamera.CFrame * CFrame.new(0, 0, -offset - 0.5)
part.Size = Vector3.new(ScreenSpace.ScreenWidthToWorldWidth(ViewSizeX, -offset), ScreenSpace.ScreenHeightToWorldHeight(ViewSizeY, -offset), 1)
end)