util.QuickTrace
From GMod Wiki
| Function | |
| Syntax |
util.QuickTrace( Vector origin, Vector offset, Table /Entity filter ) Where is this used? |
| Description: | |
| Simple trace function. | |
| Returns: | Table :traceres |
| Part of Library: | Util |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Util.QuickTrace]Util.QuickTrace [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Definition of the function
Because it is a convenience function, it is defined by Lua.
function util.QuickTrace( origin, dir, filter ) local trace = {} trace.start = origin trace.endpos = origin + dir trace.filter = filter return util.TraceLine( trace ) end
Examples
| Description | Do a trace from 128, 128, 128 to 0, 0, 256. |
|---|---|
| Used on | |
| Code | traceRes = util.QuickTrace( Vector(128, 128, 128), Vector(-128, -128, 128) ) |
| Output | N/A |
Additional Notes
- If you are tracing from an Entity or Player , make sure you include it in the filter, otherwise that entity will be returned.
- If you use an angle Vector , be sure to multiply it by the maximum distance of your trace.
local Trace = util.QuickTrace( ply:GetShootPos(), ply:GetAimVector() * 10000, { ply } )