Skip to main content

traceless.trace

Each function takes an options table. Vector fields accept Vector userdata or a table containing numeric x, y, and z. Entity fields accept entity userdata or nil. Missing/malformed required vectors raise errors; stale entity options return nil, reason. Returned structures are snapshots.

line​

traceless.trace.line({from = start, to = finish, skip = nil, mask = 0x1C300B})

Returns: TraceResult table; or nil, reason.

from and to are required. skip optionally excludes one entity. The optional numeric mask defaults to the native shot mask; nonnumeric mask values retain that default. Lua numbers cannot represent every 64-bit mask exactly.

hull​

traceless.trace.hull({from = start, to = finish, mins = mins, maxs = maxs, skip = nil})

Returns: TraceResult table; or nil, reason.

All four vector fields are required. Uses the native shot mask; this function does not read a custom mask field.

visibility​

traceless.trace.visibility({from = start, to = finish, skip = nil})

Returns: visible boolean, TraceResult; or nil, reason.

Uses the native shot mask. visible is true only when start_solid is false and the clamped trace fraction exceeds 0.97.

penetration​

traceless.trace.penetration({from = start, to = finish, shooter = nil, target = nil, ignore_penetration = false})

Returns: PenetrationResult table; or nil, reason.

shooter defaults to the local pawn; an explicit shooter must resolve to a pawn. Optional target must be a pawn or an error is raised. Missing shooter/weapon data and stale handles fail with a reason. ignore_penetration uses Lua truthiness. A valid computation returns a result table even when success is false.

local traceless = require("traceless")
local result, reason = traceless.trace.line({
from = traceless.vector(0, 0, 0),
to = traceless.vector(0, 0, 100),
})
if result then traceless.console.info(result.fraction) end