util/TraceEntity

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Changed arguments to correct order)
m
Line 9: Line 9:
 
|type=table
 
|type=table
 
|name=tracedata
 
|name=tracedata
|desc=The {{Struct| Trace}}
+
|desc=The {{Struct|Trace}}
 
}}
 
}}
 
{{Arg
 
{{Arg

Revision as of 12:15, 19 July 2013

 util.TraceEntity( )

Contents

Description

Runs a trace using the ent's collisionmodel between two points, returning a TraceRes structure

Arguments

table tracedata

Arguments

Entity ent

The entity to use

Returns

table

traceRes

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
 ...


Personal tools
Navigation