Global/PrecacheParticleSystem

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(link)
 
Line 19: Line 19:
 
-- A test console command to see if the particle works, spawns the particle where the player is looking at.  
 
-- A test console command to see if the particle works, spawns the particle where the player is looking at.  
 
concommand.Add( "particleitup", function( ply, cmd, args )
 
concommand.Add( "particleitup", function( ply, cmd, args )
ParticleEffect( "ExplosionCore_wall", ply:GetEyeTrace().HitPos, Angle( 0, 0, 0 ) )
+
local tr = ply:GetEyeTrace()
 +
ParticleEffect( "ExplosionCore_wall", tr.HitPos, tr.HitNormal:Angle() )
 
end )
 
end )
 
end
 
end
 
}}
 
}}

Latest revision as of 16:40, 15 January 2020

 PrecacheParticleSystem( )

Contents

Description

Precaches the particle with the specified name.

Arguments

string particleSystemName

The name of the particle system.

Examples

Example

Example usage of the function. Precaches "ExplosionCore_wall" particle from "particles/explosion.pcf", a Team Fortress 2 particle file.

You can find a list of particles inside a .pcf file using the Particle Editor Tool

game.AddParticles( "particles/explosion.pcf" )
PrecacheParticleSystem( "ExplosionCore_wall" )

if ( SERVER ) then
	-- A test console command to see if the particle works, spawns the particle where the player is looking at. 
	concommand.Add( "particleitup", function( ply, cmd, args )
		local tr = ply:GetEyeTrace()
		ParticleEffect( "ExplosionCore_wall", tr.HitPos, tr.HitNormal:Angle() )
	end )
end


Personal tools
Navigation