Garry's Mod Wiki

Garry's Mod Wiki

  table Entity:GetTouchTrace()

Description

Returns the last trace used in the collision callbacks such as ENTITY:StartTouch, ENTITY:Touch and ENTITY:EndTouch.

This returns the last collision trace used, regardless of the entity that caused it. As such, it's only reliable when used in the hooks mentioned above

Returns

Example

Dispatches an explosion at the point of impact with another entity.

function ENT:Touch( otherEntity ) local tr = self:GetTouchTrace() local hitPos = tr.HitPos local effectdata = EffectData() effectdata:SetOrigin( hitPos ) util.Effect( "Explosion", effectdata ) 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...