Trail

particle.trail.create

Client

Creates a new trail

Syntax

local instance = particle.trail.create()

A trail draws the path it travels.

  • Follows its position — move it every frame, for example onto a bone with model:get_bone_position, and the trail draws the path it travelled.
  • Fades out — the trail is full width and color at its start, then thins out and fades towards its end, see self:set_lifetime, self:set_width and self:set_color.
  • At rest — while the trail stands still it shrinks away on its own.
  • Not a particle emitter — the trail is a mesh built from the path it travels, so it needs no emission, amount or velocity settings.

Parameters

No parameters are accepted by this function

Returns

TypeNameDescription
trailinstanceTrail instance

Examples

Draw a trail behind a hand
local trail = particle.trail.create()

trail:set_width(0.08)
trail:set_lifetime(0.4)
trail:set_color({0.1, 0.5, 0.8, 0.9}, {0.55, 0.8, 1, 0})

util.event.on("sandbox:process", function()
    trail:set_global_position(model:get_bone_position("DEF-hand.R"))
end)

On this page