self:project_position

Client

Retrieves the world-space position corresponding to a screen point at a given depth


Syntax

local result = self:project_position(
    position,
    depth
)

Parameters

TypeNameDescription
vector2positionPosition on the screen in pixels
floatdepthDepth distance from the camera

Returns

TypeNameDescription
vector3resultWorld-space position at the given screen point and depth

Examples

Project a screen point into world space
local entity = core.camera.create()

entity:set_active()

local world_position = entity:project_position({960, 540}, 10)

core.engine.print("info", "World position:", util.table.unpack(world_position))

On this page