Garry's Mod Wiki

Player:GetUseEntity

  Entity Player:GetUseEntity()

Description

Returns the entity the player would use if they would press their +use keybind.

Because entity physics objects usually do not exist on the client, the client's use entity will resolve to whatever the crosshair is placed on within a little less than 72 units of the player's eye position. This differs from the entity returned by the server, which has fully physical use checking. See util.TraceHull.

Issue tracker: 5027

Returns

1 Entity ent
The entity that would be used or NULL.