Garry's Mod Wiki

ents.FindAlongRay

  table ents.FindAlongRay( Vector start, Vector end, Vector mins = nil, Vector maxs = nil )

Description

Returns a table of all entities along the ray. The ray does not stop on collisions, meaning it will go through walls/entities.

This internally uses a Spatial Partition to avoid looping through all entities.

Arguments

1 Vector start
The start position of the ray
2 Vector end
The end position of the ray
3 Vector mins = nil
The mins corner of the ray
4 Vector maxs = nil
The maxs corner of the ray

Returns

1 table
Table of the found entities. There's a limit of 1024 entities.