Converting 2D Frame Size to 3D World Size

So I’m trying to create 3D UI and I’ve got the positioning down which wasn’t too hard just getting the center off the frame and passing to the ScreenPointToRay function and using the origin and direction and then constructing a CFrame

But my main problem right now is converting the frames size to world size, while also taking into account like the camera’s field of view and of course the screen size?

The red part is the part and the transparent gray frame is the Frame

Have you tried using BillboardGui? Or are you trying to make something else?

Edit: SurfaceGui is also a good way to make UI stick onto a part surface, while BillboardGui will automatically rotate to a player’s camera and scale automatically so the player can see it from far away.

1 Like

Yeah but the thing is that I had a system where I had a SurfaceGui and UI stuff on it and I was able to position it where I wanted relative to the camera from the ScreenPointToRay function, but the problem was that when I would change the FOV of the camera it wouldn’t adjust the position and size so everything would just ‘break’ basically not scale correctly, and it’s super confusing because I have to account for depth im thinking depending on the size of the frame

You could do it, but it would probrably take a lot of work, like, a lot. However, this link might help you do this: Custom 3D GUI Game Engine With Textures - Help and Feedback / Creations Feedback - Developer Forum | Roblox

1 Like