Garry's Mod Wiki

util.TraceEntity

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.

Clientside entities will not be hit by traces.

Arguments

1 table tracedata
Trace data. See Structures/Trace
2 Entity ent
The entity to use

Returns

1 table
Trace result. See Structures/TraceResult

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

Page Links


Special Pages


Wikis

?

Render Time: 45ms

Session 0
DB GetPage 5
Generate Html 10
SaveChanges 17
Render Body 0
Render Sidebar 11