ENTITY/Touch

From Garry's Mod
Jump to: navigation, search
 ENTITY:Touch( )

Contents

Description

Called every tick for every entity being "touched".

See also ENTITY:StartTouch and ENTITY:EndTouch.

WARNING

This only works for brush entities and for entities that have Entity:SetTrigger set to true.

NOTE

For physics enabled entities, this hook will not be ran while the entity's physics is asleep. See PhysObj:Wake.

Arguments

Entity entity

The entity that touched it.

Examples

Example

function ENTITY:Touch(entity)
	self:EmitSound("ambient/explosions/explode_" .. math.random(1, 9) .. ".wav")
	self:Remove()
end
Personal tools
Navigation