Garry's Mod Wiki

Revision Difference

ents.FindInSphere#562113

<function name="FindInSphere" parent="ents" type="libraryfunc"> <description> Gets all entities within the specified sphere. ⤶ <note>This internally uses a Spatial Partition to avoid looping through all entities.</note>⤶ <note>This function internally calls <page>ents.FindInBox</page> with some [radius checks](https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/collisionutils.cpp#L256-L301) so therefore has the same limitations.</note>⤶ ⤶ Serverside, this uses a Spatial Partition internally to avoid looping through all entities, so it is more efficient than using <page>ents.GetAll</page> for this purpose.⤶ ⤶ Clientside, this function internally calls <page>util.IsBoxIntersectingSphere</page>⤶ </description> <realm>Shared</realm> <args> <arg name="origin" type="Vector">Center of the sphere.</arg> <arg name="radius" type="number">Radius of the sphere.</arg> </args> <rets> <ret name="" type="table">A table of all found <page>Entity</page>s.</ret> </rets> </function>