Garry's Mod Wiki

Garry's Mod Wiki

  ENTITY:Touch( Entity entity )

Description

Called every tick for every entity being "touched". Touching is usually detected via AABB intersection checks using entity's collision bounds.

Entities like triggers would be using the touch hooks for their function.

See Entity:PhysicsCollide for physics based collision events.

See also ENTITY:StartTouch and ENTITY:EndTouch.

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

Arguments

1 Entity entity
The entity that touched it.

Example

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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...