I’ve made a part with a surfaceGUI to constantly follow the player with the purpose so that it can have a tilt effect to it, similar to something from phighting.
I’ve gotten it to follow the player’s camera and orientation, but when I try to change the Y to make it tilt, this happens:
How it normally looks like before the tilt:
Here’s my code:
local RunService = game:GetService("RunService")
local curCam = workspace.CurrentCamera
local GUIobjects = workspace.GUIobjects
local playerInfo = GUIobjects:WaitForChild("PlayerInfo")
local playerInfoScale = {0.21, 0.78}
local function ScaleToOffset(scale)
return (scale[1] * curCam.ViewportSize.X), (scale[2] * curCam.ViewportSize.Y)
end
playerInfo.Parent = curCam
RunService.RenderStepped:Connect(function(deltaTime)
local playerInfoOffsetX, playerInfoOffsetY = ScaleToOffset(playerInfoScale)
local playerInfoRay = curCam:ScreenPointToRay(playerInfoOffsetX, playerInfoOffsetY)
local x, y, z = curCam.CFrame:ToOrientation()
playerInfo.Position = playerInfoRay.Origin + playerInfoRay.Direction * 2.7
playerInfo.Orientation = Vector3.new(0, math.deg(y) - 90, -(math.deg(x)) - 90)
end)
I’ve tried changing the other axes, looking for anything on the web, but this thing seems very niche, so I’ve heard no one talk about it other than these two posts.
I just asking, how to make curved/ 3d ish screen gui?
How can i make Curved UI
If anyone can help, me, it’d be very appreciated.