Skip to content

Api > LuaBehaviour > OnParticleCollision()


LuaBehaviour.OnParticleCollision(GameObject gameObject)⚓︎

OnParticleCollision is called when a particle hits a Collider.

Parameters:⚓︎

Name Type Description
gameObject GameObject GameObject represents the ParticleSystem which the particle is originated

Usage⚓︎

local script = LUA.script;

--- OnParticleCollision message from LuaBehaviour
---@param gameObject GameObject
function script.OnParticleCollision(gameObject)
   -- your code here 
end

Extra Detail⚓︎

This can be used to apply damage to a GameObject when hit by particles. This message is sent to scripts attached to Particle Systems and to the Collider that was hit.