Player.GetEyeTrace
From GMod Wiki
Revision as of 20:32, 4 October 2010 by Unrealomega (Talk | contribs)
Function | |
Syntax | Player:GetEyeTrace( ) |
Description: | |
Traces a line from the player's view and returns a trace structure. | |
Returns: | Table :traceres |
In Object: | Player |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.GetEyeTrace]Player.GetEyeTrace [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Traces a line from player 1 and stores the results. |
---|---|
Used on | |
Code | pl=player.GetByID(1) traceRes=pl:GetEyeTrace() |
Output | Trace results from player 1 stored in traceRes |
Additional Notes
- This is more efficient than doing your own trace as it is only created once per frame and cached.
- This is now part of the base gamemode and should always be available.
- This uses the cursor aim vector, so if your cursor is visible, you will get a trace to what your mouse is over.
- See also Player.GetEyeTraceNoCursor which is like GetEyeTrace but doesn't use the cursor aim vector.
- Does not appear to trace for the eye as of October 4th, 2010. Appears to trace from the base of the player.