CLuaEmitter

From GMod Wiki

Revision as of 17:26, 10 February 2011 by garry :D (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This object is created with the global function ParticleEmitter(), and is used in scripted effects to create and handle Particles. It has two methods once created, Add and Finish.

Library

NewerClient.png CLuaEmitter:__gc
NewerClient.png CLuaEmitter:__index
NewerClient.png CLuaEmitter:Add
NewerClient.png CLuaEmitter:Draw
NewerClient.png CLuaEmitter:Finish
NewerClient.png CLuaEmitter:GetNumActiveParticles
NewerClient.png CLuaEmitter:SetBBox
NewerClient.png CLuaEmitter:SetNearClip
NewerClient.png CLuaEmitter:SetNoDraw
NewerClient.png CLuaEmitter:SetParticleCullRadius
NewerClient.png CLuaEmitter:SetPos

Examples

DescriptionEmits 20 particles of varying transparency from 100 units above the world origin.
Used onNewerClient.png
Code
local centr = Vector(0,0,100)
local em = ParticleEmitter(centr)
for i=1, 20 do
     local part = em:Add("sprites/light_glow02_add",centr)
     if part then
          part:SetColor(255,255,255,math.random(255))
          part:SetVelocity(Vector(math.random(-1,1),math.random(-1,1),math.random(-1,1)):GetNormal() * 20)
          part:SetDieTime(0.5)
          part:SetLifeTime(0)
          part:SetStartSize(10)
          part:SetEndSize(0)
     end
end
em:Finish()
OutputN/A


See also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox