util.TraceEntity

From Garry's Mod
Revision as of 10:10, 21 October 2013 by Robotboy655 (Talk | contribs)
Jump to: navigation, search
 util.TraceEntity( )

Contents

Description

Runs a trace using the ent's collisionmodel between two points.

Arguments

table tracedata

Trace data. See Trace structure

Arguments

Entity ent

The entity to use

Returns

table

Trace result. See TraceResult structure

Examples

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


Personal tools
Navigation