util.GetPlayerTrace

From GMod Wiki

Jump to: navigation, search
Function
Syntax util.GetPlayerTrace( Player ply[, Vector dir] )
Where is this used?
Description:
Utility function to quickly generate a trace table that starts at the players view position, and ends 16384 units along a specified direction (or the players aim vector if dir isn't provided.
Returns: Table
Part of Library: Util
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Util.GetPlayerTrace]Util.GetPlayerTrace [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDo a trace from the player, based on their aim vector.
Used onNewerShared.png
Code
 
trace = util.GetPlayerTrace( player_obj)
traceRes=util.TraceLine(trace)
 
OutputN/A


DescriptionDo a trace from the player, upwards.
Used onNewerShared.png
Code
 
trace = util.GetPlayerTrace( player_obj, Vector(0,0,1) )
traceRes=util.TraceLine(trace)
 
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox