How to get object's Position on screen? (Or convert Vector3 to Vector2)

Hello guys. I’m making my plugin. Because I don’t love roblox built-in handles and archandles, I want make my own ones. But I met one problem - IDK how to get object’s position on screen. (or off screen if it goes outside)
image


(I want get that white plane position on screen, while I know only it’s CFrame and camera’s CFrame)

This might be fancy, but it just works in my head. If you use ScreenGUI to find the position, I think it might work??

Create a ScreenGUI with a Frame inside it, and try to find the position of your white plane and set your Frame to that location. Then you can grab the value of that Frame position to achieve what you want

This is my idea, never tried implementing one.

1 Like

Try using Camera:WorldToScreenPoint

local screenPosition: Vector3, inView: boolean = workspace.CurrentCamera:WorldToScreenPoint(part.Position)
local screenVector: Vector2 = Vector2.new(screenPosition.X, screenPosition.Y)
-- (The Z value is how far away the part is from the screen, which we don't care about)
6 Likes

Even if you do implement it by some magic way it won’t work. What you’re saying is to just make a frame inside a ScreenGui, nothing to do with tracking a position.

@GamEditoPro, could this help you?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.