|Function name||Player:getEyeSightHitEntity(number searchDistance, number hitDistance, function filter)|
|Get the entity that is closest to a player's line of sight and its distance.|
|Returns:||Entity closestEnt, number distance|
|Part of Library:||Player|
- searchDistance (number) (optional)
- hitDistance (number) (optional)
- filter (function) (optional)
How far to look. You usually don't want this function to return an entity millions of units away. The default is 100 units.
The maximum distance between the player's line of sight and the object. Basically how far the player can be 'looking away' from the object. The default is 15 units.
The filter for which entities to look for. By default it only looks for players.
Function return values
- closestEnt (Entity)
- distance (number)
The entity that is closest to the player's line of sight. Returns nil when not found.
The (minimum) distance between the player's line of sight and the object.