self:project_local_ray_normal
Client
Retrieves a normalized direction vector in local camera space through a given screen point
Syntax
local result = self:project_local_ray_normal(
position
)Parameters
| Type | Name | Description |
|---|---|---|
vector2 | position | Position on the screen in pixels |
Returns
| Type | Name | Description |
|---|---|---|
vector3 | result | Normalized direction vector in local camera space through the given screen point |
Examples
local resolution = core.engine.get_resolution()
local center = {resolution[1]*0.5, resolution[2]*0.5}
local entity = core.camera.create()
entity:set_active()
local local_ray = entity:project_local_ray_normal(center)
core.engine.print("info", "Local ray direction:", util.table.unpack(local_ray))