ents.FindInBox
From GMod Wiki
Function | |
Syntax |
ents.FindInBox( Vector min, Vector max ) Where is this used? |
Description: | |
Find all entities within a specified bounding box. | |
Returns: | Table : Entity |
Part of Library: | Ents |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Ents.FindInBox]Ents.FindInBox [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | This example finds all the entities near the origin of the map |
---|---|
Used on | |
Code | local orgin_ents = ents.FindInBox( Vector(-32,-32,-32), Vector(32,32,32) ) |
Output | N/A |
Additional Notes
- When using this function, make sure not to query boxes that contains parts out of a map boundaries. Doing this will likely cause stuttering (even if few entities are around locally or globally), in the worst case a crash. Considering a map is contained in a (-16384, -16384, -16384),(16384, 16384, 16384) box, you should consider passing the arguments to a function similar to this one, especially if you're querying large boxes that are likely to be near the corner of a map at any time :
function ClampWorldVector(vec) vec.x = math.Clamp( vec.x , -16380, 16380 ) vec.y = math.Clamp( vec.y , -16380, 16380 ) vec.z = math.Clamp( vec.z , -16380, 16380 ) return vec end
- It does not seem to be able to return any world entities.