trace
World / entity line and hull traces.
Line
trace.line(start: vector, end: vector, skip?: entity): { fraction, hit, entity, ... } | nil
- Traces a line from
starttoend. - Vectors can be
{x,y,z}or three numbers each. skipdefaults to the local player pawn.
local tr = secret.trace.from_eyes(8192)
if tr and tr.hit then
print(tr.fraction, tr.entity and tr.entity:name())
end
local me = secret.game.local_player()
local ex, ey, ez = me:eye_pos()
local pitch, yaw = secret.game.get_view_angles()
local fx, fy, fz = secret.math.angle_forward(pitch, yaw)
local dist = 8192
local tr = secret.trace.line(ex, ey, ez, ex + fx * dist, ey + fy * dist, ez + fz * dist)
Result fields: fraction, all_solid, hit, start_pos, end_pos, pos, normal, entity.
trace.from_eyes(distance?: number, skip?: entity): table | nil
- Traces from the local eye position along the current view angles.
distancedefaults to8192.
Hull
trace.hull(start: vector, end: vector, mins: vector, maxs: vector, skip?: entity): table | nil
- Hull / bbox trace with
mins/maxs.