Garry's Mod Wiki

Revision Difference

Player:GetEyeTrace#528773

<function name="GetEyeTrace" parent="Player" type="classfunc"> <description> Returns a table with information of what the player is looking at. The results of this function are cached every frame. The results of this function are cached clientside every frame. Uses <page>util.GetPlayerTrace</page> internally and is therefore bound by its limits. See also <page>Player:GetEyeTraceNoCursor</page> </description> <realm>Shared</realm> <rets> <ret name="" type="table">Trace information, see <page>Structures/TraceResult</page></ret> </rets> </function> <example> <description>Prints the entity the player is looking at.</description> <code>print( Entity( 1 ):GetEyeTrace().Entity )</code> <output>"Entity [0][worldspawn]" in console, if you aim at world.</output> </example>