Player/GetEyeTrace

From Garry's Mod
Jump to: navigation, search
 Player:GetEyeTrace( )

Contents

Description

Returns a table with information of what the player is looking at.

The results of this function are cached every frame.

See also Player:GetEyeTraceNoCursor

Returns

table

Trace information, see TraceResult structure

Examples

Example

Prints the entity the player is looking at.

print( Entity( 1 ):GetEyeTrace().Entity )

Output:

"Entity [0][worldspawn]" in console, if you aim at world.
Personal tools
Navigation