graphics.world_to_screen
Project an Unreal world position into screen pixels.
Syntax
ue.graphics.world_to_screen(
location: table,
player_controller?: UObjectProxy
) -> table?, boolean | stringParameters
| Parameter | Type | Description |
|---|---|---|
location | table | World position with X, Y, Z fields. Lowercase keys are also accepted. |
player_controller | UObjectProxy? | Controller used for projection. Default: first local controller. |
Returns
On success:
| Value | Type | Description |
|---|---|---|
| Screen position | { x: number, y: number } | Absolute screen position in pixels. |
| Visible | boolean | Unreal's projection result. Check before drawing. |
On failure, returns nil, error_string.
Example
local actor = assert(ue.find_first("Character"))
local world = actor:K2_GetActorLocation()
local screen, visible = ue.graphics.world_to_screen(world)
if visible then
ue.graphics.text(screen.x, screen.y, actor:name())
end