util.SpriteTrail

From Garry's Mod
Jump to: navigation, search
 util.SpriteTrail( )

Contents

Description

Adds a trail to the specified entity.

Arguments

Entity ent

Entity to attach trail to

Arguments

number attachmentID

Attachment ID of the entitiys model to attach trail to. If you are not sure, set this to 0

Arguments

table color

Color of the trail, use Color

Arguments

boolean additive

Should the trail be additive or not

Arguments

number startWidth

Start width of the trail

Arguments

number endWidth

End width of the trail

Arguments

number lifetime

How long it takes to transition from startWidth to endWidth

Arguments

number textureRes

The resolution of trails texture. A good value can be calculated using this formula: 1 / ( startWidth + endWidth ) * 0.5

Arguments

string texture

Path to the texture to use as a trail.

Returns

Entity

Entity of created trail (env_spritetrail)

Examples

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 )


Personal tools
Navigation