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
| Type | Name | Description |
|---|---|---|
vector2 | position | Position on the screen in pixels |
Returns
| Type | Name | Description |
|---|---|---|
vector3 | result | World-space origin of the ray cast from the given screen point |
Examples
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))