CLuaParticle.SetCollideCallback

From GMod Wiki

Jump to: navigation, search
Function
Syntax CLuaParticle:SetCollideCallback( Function callback )
Description:
Sets a particle's collision callback.
Returns: nil
In Object: Cluaparticle
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=CLuaParticle.SetCollideCallback]CLuaParticle.SetCollideCallback [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionCreates an explosion every time an particle collides with something.
Used onNewerClient.png
Code
--Imagine you already defined MyParticle somewhere
MyParticle:SetCollideCallback( function( part, hitpos, hitnormal ) --This is an in-line function
    local efdata = EffectData() --Grab base EffectData table
    efdata:SetOrigin( hitpos ) --Sets the origin of it to the hitpos of the particle
    util.Effect( "Explosion", efdata ) --Create the effect
end )
OutputN/A

Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox