Craig Martin

(Official) LUA Scripting Documentation

intersect_ray

Ray intersection query.


Spec:

intersect_ray(
	double x1,
	double y1,
	double z1,
	double x2,
	double y2,
	double z2,
	bool players,
	bool npcs,
	bool display)

Parameters

Returns


The context target is set as the closest actor hit by the ray


Example

local dir = vector3(get_view_dir())
local eye = vector3(get_eye_pos()) + (dir * 0.2)
local far = eye + (dir * 50)
if
intersect_ray(eye.x, eye.y, eye.z, far.x, far.y, far.z)
then
set_context("target")
add_health_effect(-30)
end

Incomplete

This documentation is incomplete


back