Procgen Effects Showcase
- ..
- .metadata1.1 KB
- README.md1.4 KB
- graph.json16.4 KB
- init.luau6.9 KB
- preview.png2.1 KB
README.md
tracer
The glowing streak of a round in flight: a white-hot streak leaving the muzzle
along -Z and burning out distance metres on, shedding embers that fall and
cool behind it.
Fire it at the muzzle with its -Z turned toward what the round hits, and
distance the range to it:
-- `graph` is this graph's reference: the AssetRef `asset.resolve` or a search returns for it.
local function tracer(from, to)
local dx, dy, dz = to[1] - from[1], to[2] - from[2], to[3] - from[3]
local e = entity.spawn("tracer", { position = from, temporary = true })
e:lookAt(to)
e.component.add("Generator", {
graph = graph, playOn = "load", ending = "hold",
params = { distance = math.sqrt(dx * dx + dy * dy + dz * dz) },
})
e.component.get("Generator").events.onFinished:connect(function()
e:despawn()
end)
return e
end
| Input | Default | What it does |
|---|---|---|
distance | 40 | How far the round flies before it burns out, in metres: the range to what it hits. |
speed | 240 | How fast it flies, in metres per second. |
width | 0.04 | Width of the streak, in metres. |
The streak runs back from the round for as far as it flies in a sixtieth of a
second, and never behind the muzzle. It plays 45 frames at 60 fps (0.75 s).
Each distance is its own set of frames: plays at one range share what the
first one cooked.