Garry's Mod Wiki

CLuaParticle:SetCollideCallback

CLuaParticle:SetCollideCallback( function collideFunc )

Description

Sets the function that gets called whenever the particle collides with the world.

Arguments

1 function collideFunc
Collide callback, the arguments are:

CLuaParticle particle - The particle itself

Vector hitPos - Position of the collision

Vector hitNormal - Direction of the collision, perpendicular to the hit surface

Example

Creates an explosion every time an particle collides with something.

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 )

Page Links


Special Pages


Wikis

?

Render Time: 36ms

DB GetPage 5
Generate Html 5
SaveChanges (1) 18
Render Body 0
Render Sidebar 5