Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

fumo:trace

Trace calls require the trace capability.

import { trace } from "fumo:trace";

const from = { x: 0, y: 0, z: 64 };
const to = { x: 256, y: 0, z: 64 };

const ray = trace.ray({ from, to });
const hull = trace.hull({
    from,
    to,
    mins: { x: -16, y: -16, z: 0 },
    maxs: { x: 16, y: 16, z: 72 }
});

const visible = trace.visibility({ from, to });
const smoked = trace.throughSmoke({ from, to });

Ray and hull results are copied objects containing hit, world, startSolid, fraction, start, end, normal, and entityIndex. No engine pointer is exposed.

Penetration estimates accept copied weapon values:

const result = trace.penetration({
    from,
    to,
    damage: 40,
    penetration: 2,
    range: 8192,
    rangeModifier: 0.98,
    maximumPenetrations: 4
});

The runtime allows 128 regular trace/smoke calls and eight penetration estimates per owner-lane pump. Counters reset for the next pump.