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 | string

Parameters

ParameterTypeDescription
locationtableWorld position with X, Y, Z fields. Lowercase keys are also accepted.
player_controllerUObjectProxy?Controller used for projection. Default: first local controller.

Returns

On success:

ValueTypeDescription
Screen position{ x: number, y: number }Absolute screen position in pixels.
VisiblebooleanUnreal'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

On this page