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
| Type | Name | Description |
|---|---|---|
vector2 | position | Position on the screen in pixels |
float | depth | Depth distance from the camera |
Returns
| Type | Name | Description |
|---|---|---|
vector3 | result | World-space position at the given screen point and depth |
Examples
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))