util/TraceEntity

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Clientside ents note)
m (This trace does not rotate)
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Description=Runs a trace using the entity's collisionmodel between two points.
+
|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.
  
 
{{Note|Clientside entities will not be hit by traces.}}
 
{{Note|Clientside entities will not be hit by traces.}}

Latest revision as of 15:10, 31 July 2018

 util.TraceEntity( )

Contents

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.

NOTE

Clientside entities will not be hit by traces.

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