Garry's Mod Wiki

Player:GetEyeTrace

table Player:GetEyeTrace()

Description

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

The results of this function are cached every frame.

Uses util.GetPlayerTrace internally and is therefore bound by its limits.

See also Player:GetEyeTraceNoCursor

Returns

1 table
Trace information, see Structures/TraceResult

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.

Page Links


Special Pages


Wikis

?

Render Time: 200ms

DB GetPage 55
Generate Html 6
SaveChanges (1) 124
Render Body 0
Render Sidebar 13