Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

impact

A round striking a hard surface: a flash, a spray of sparks thrown back off it that fall and cool, a burst of dust and grit that billows and settles, and a flicker of light on the surface.

Fire it where the round lands, with the effect's -Z turned along the normal of the surface it struck, and let it go when it ends:

-- `graph` is this graph's reference: the AssetRef `asset.resolve` or a search returns for it.
local function hitEffect(position, normal)
    local e = entity.spawn("impact", { position = position, temporary = true })
    e:lookAt({ position[1] + normal[1], position[2] + normal[2], position[3] + normal[3] })
    e.component.add("Generator", { graph = graph, playOn = "load", ending = "hold" })
    e.component.get("Generator").events.onFinished:connect(function()
        e:despawn()
    end)
    return e
end
InputDefaultWhat it does
size1How big the strike is: 1 a rifle round on concrete, 3 a heavy round, 0.4 a pistol.
light1Strength of the light it throws, as a multiple of the default.

Set them with the Generator's params, e.g. params = { size = 3 }. It plays 66 frames at 60 fps (1.1 s). Every play with the same params plays the frames the first one cooked.