Garry's Mod Wiki

util.SpriteTrail

  Entity util.SpriteTrail( Entity ent, number attachmentID, table color, boolean additive, number startWidth, number endWidth, number lifetime, number textureRes, string texture )

Description

Adds a trail to the specified entity.

Arguments

1 Entity ent
Entity to attach trail to
2 number attachmentID
Attachment ID of the entities model to attach trail to. If you are not sure, set this to 0
3 table color
Color of the trail, use Color
4 boolean additive
Should the trail be additive or not
5 number startWidth
Start width of the trail
6 number endWidth
End width of the trail
7 number lifetime
How long it takes to transition from startWidth to endWidth
8 number textureRes
The resolution of trails texture. A good value can be calculated using this formula: 1 / ( startWidth + endWidth ) * 0.5
9 string texture
Path to the texture to use as a trail.

Returns

1 Entity
Entity of created trail (env_spritetrail)

Example

A console command that gives the player a red trail.

concommand.Add( "givetrail", function( ply ) local trail = util.SpriteTrail( ply, 0, Color( 255, 0, 0 ), false, 15, 1, 4, 1 / ( 15 + 1 ) * 0.5, "trails/plasma" ) print( trail ) end )