Garry's Mod Wiki

Garry's Mod Wiki

  table util.TraceEntity( table tracedata, Entity ent )

Description

Runs a trace using the entity's collisionmodel between two points. This does not take the entity's angles into account and will trace its unrotated collisionmodel.

Arguments

1 table with Trace structure tracedata
Trace data. See Trace structure
2 Entity ent
The entity to use

Returns

Example

From sandbox/gamemode/prop_tools.lua, this checks if there are any entities inside our entity

local trace = { start = ent:GetPos(), endpos = ent:GetPos(), filter = ent } local tr = util.TraceEntity( trace, ent ) if ( tr.Hit ) then -- Do stuff 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...