WorldToViewportPoint
Projects a world position through the camera. Returns (x, y, depth) in screen space plus true when on screen.
Syntax
:WorldToViewportPoint(vector: Vector3) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
vector | Vector3 | The vector value used by the call. |
Returns
| Type | Description |
|---|---|
boolean | Vector3, boolean |
Description
WorldToViewportPoint is part of the Instances library. Instances are live proxies backed by game memory. Property reads and method calls go through Roblox's own objects.
The operation is performed immediately using the arguments supplied at the call site.
The aliases :WorldToScreenPoint(vector) resolve to the same implementation.
Example
local cam = workspace.CurrentCamera
local pos, visible = cam:WorldToViewportPoint(target.Position)
if visible then
print(math.floor(pos.X), math.floor(pos.Y), pos.Z)
end
Notes
- Aliases:
:WorldToScreenPoint(vector). - Instance proxies are backed by live game memory.