worldtoscreen
Projects a Vector3 through the current camera and reports whether it is visible.
Syntax
worldtoscreen(position: Vector3) -> Vector2, boolean
WorldToScreen(position: Vector3) -> Vector2, boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
position | Vector3 | World-space point to project. |
Returns
| Type | Description |
|---|---|
Vector2 | Screen position in client-space pixels. |
boolean | True when the point is in front of the camera and inside the viewport. |
Description
The function reads the current camera from Workspace and projects the point using the same path as Camera:WorldToViewportPoint.
When there is no camera, or projection fails, it returns Vector2(0, 0), false.
Example
local screen, onScreen = worldtoscreen(Vector3.new(0, 10, 0))
if onScreen then
print(screen.X, screen.Y)
end
Notes
WorldToScreenis an alias ofworldtoscreen.- The boolean is false for off-screen points, not only points behind the camera.
:WorldToViewportPoint()and:WorldToScreenPoint()remain available on instances.