self:project_ray_origin

Client

Retrieves the world-space origin point of a ray cast from a given screen point


Syntax

local result = self:project_ray_origin(
    position
)

Parameters

TypeNameDescription
vector2positionPosition on the screen in pixels

Returns

TypeNameDescription
vector3resultWorld-space origin of the ray cast from the given screen point

Examples

Get a ray origin from a screen point
local entity = core.camera.create()
local position = {960, 540}

entity:set_active()

local ray_origin = entity:project_ray_origin(position)
local ray_normal = entity:project_ray_normal(position)

core.engine.print("info", "Ray from:", util.table.unpack(ray_origin))
core.engine.print("info", "Ray towards:", util.table.unpack(ray_normal))

On this page