trace

line

Traces a line and returns the trace data

trace_result_t line(<vec3_t> start, <vec3_t> end, [optional] <entity_t> ignore_entity, [optional] <int> trace_mask = MASK_SOLID)

Example

local trace_result = trace.line(from, to, local_player)
if(trace_result.entity ~= nil) then
    print("hit:",trace_result.entity:get_name())
end

hull

Performs a hull trace and returns the trace data

trace_result_t hull(<vec3_t> start, <vec3_t> end, <vec3_t> hull_mins, <vec3_t> hull_maxs, [optional] <entity_t> ignore_entity, [optional] <int> trace_mask = MASK_SOLID)

Example

local trace_result = trace.hull(from, to, box_mins, box_maxs, local_player)
if(trace_result.entity ~= nil) then
    print("hit:",trace_result.entity:get_name())
end

bullet

Performs a bullet trace (autowall) and returns the bullet data

bullet_data_t bullet(<vec3_t> start, <vec3_t> end, [optional] <entity_t> attacker = local_player, [optional] <entity_t> target)

Example

local trace_result = trace.bullet(from, to, local_player, enemy)
if(trace_result.valid and trace_result.damage > 0) then
    print("player can be damaged")
end

Last updated